Compare commits

...

9 Commits

10 changed files with 879 additions and 3 deletions
+89
View File
@@ -0,0 +1,89 @@
# Docker Cheatsheet
## Security First Notes
- Always run containers with least privilege: Use --user for non-root.
- Scan images for vulnerabilities: Use tools like Trivy or Docker Scout.
- Avoid hardcoded secrets: Use Docker secrets or environment variables securely.
- Enable Docker Content Trust: `export DOCKER_CONTENT_TRUST=1`
- Assume hostile environment: Validate all inputs and use secure defaults.
## Installation (Debian)
```bash
sudo apt update
sudo apt install docker.io
sudo usermod -aG docker $USER
newgrp docker
```
## Basic Commands
- Version: `docker --version`
- Info: `docker info`
- Login: `docker login`
## Images
- List images: `docker images` or `docker image ls`
- Pull image: `docker pull <image>`
- Build image: `docker build -t <tag> .`
- Remove image: `docker rmi <image>`
- Tag image: `docker tag <source> <target>`
- Save image: `docker save -o <file.tar> <image>`
- Load image: `docker load -i <file.tar>`
## Containers
- Run container: `docker run -d --name <name> <image>`
- Interactive run: `docker run -it <image> /bin/bash`
- List running: `docker ps`
- List all: `docker ps -a`
- Stop: `docker stop <container>`
- Start: `docker start <container>`
- Restart: `docker restart <container>`
- Remove: `docker rm <container>`
- Logs: `docker logs <container>`
- Exec into: `docker exec -it <container> bash`
- Stats: `docker stats`
## Volumes
- Create volume: `docker volume create <name>`
- List volumes: `docker volume ls`
- Inspect: `docker volume inspect <name>`
- Remove: `docker volume rm <name>`
## Networks
- List networks: `docker network ls`
- Create network: `docker network create <name>`
- Connect: `docker network connect <network> <container>`
- Disconnect: `docker network disconnect <network> <container>`
- Inspect: `docker network inspect <network>`
## Docker Compose
- Up: `docker-compose up -d`
- Down: `docker-compose down`
- Build: `docker-compose build`
- Logs: `docker-compose logs`
- PS: `docker-compose ps`
## Cleanup
- Prune containers: `docker container prune`
- Prune images: `docker image prune`
- Prune volumes: `docker volume prune`
- Prune networks: `docker network prune`
- Prune system: `docker system prune -a -f`
## Advanced/Security
- Run as non-root: `docker run -u $(id -u):$(id -g) <image>`
- Security options: `docker run --security-opt no-new-privileges <image>`
- Limit resources: `docker run --cpus=1 --memory=512m <image>`
- Scan for vulnerabilities: Install trivy and run `trivy image <image>`
- Content trust: `docker trust sign <image>`
- Use minimal base images: Prefer alpine or distroless for smaller attack surface.
## Docker Swarm
- Initialize swarm: `docker swarm init`
- Join worker: `docker swarm join --token <token> <manager-ip>:2377`
- List nodes: `docker node ls`
- Deploy stack: `docker stack deploy -c docker-compose.yml <stack>`
- Leave swarm: `docker swarm leave --force`
This cheatsheet prioritizes security and efficiency. For critical systems, perform additional penetration testing and use tools like Docker Bench for Security.
Sources: Based on https://www.docker.com/blog/docker-cheat-sheet/ and official docs."
+11 -1
View File
@@ -48,4 +48,14 @@ This is a quick reference for common Git commands.
- `git stash apply`: Apply stashed changes - `git stash apply`: Apply stashed changes
- `git stash list`: List stashed changes - `git stash list`: List stashed changes
For more details, refer to the official Git documentation: https://git-scm.com/docs ## Advanced Commands
- `git rebase <branch>`: Rebase current branch onto another
- `git cherry-pick <commit>`: Apply a commit from another branch
- `git reflog`: Show reference log
- `git bisect`: Binary search for bug introduction
## Submodules
- `git submodule add <repo> <path>`: Add submodule
- `git submodule update --init`: Initialize submodules
For more details, refer to the official Git documentation: https://git-scm.com/docs and https://www.geeksforgeeks.org/git-cheat-sheet/"
+48
View File
@@ -0,0 +1,48 @@
# Kubernetes Cheatsheet
## Basics
- Get cluster info: `kubectl cluster-info`
- Get nodes: `kubectl get nodes`
- Get pods: `kubectl get pods`
- Get all resources: `kubectl get all`
## Contexts and Config
- View config: `kubectl config view`
- Set context: `kubectl config use-context <context-name>`
- Set namespace: `kubectl config set-context --current --namespace=<namespace>`
## Pods
- Create pod: `kubectl run <pod-name> --image=<image>`
- Describe pod: `kubectl describe pod <pod-name>`
- Exec into pod: `kubectl exec -it <pod-name> -- /bin/sh`
- Logs: `kubectl logs <pod-name>`
- Delete pod: `kubectl delete pod <pod-name>`
## Deployments
- Create deployment: `kubectl create deployment <name> --image=<image>`
- Get deployments: `kubectl get deployments`
- Scale: `kubectl scale deployment <name> --replicas=<num>`
- Update image: `kubectl set image deployment/<name> <container>=<new-image>`
- Delete: `kubectl delete deployment <name>`
## Services
- Expose deployment: `kubectl expose deployment <name> --type=NodePort --port=80`
- Get services: `kubectl get services`
- Describe service: `kubectl describe service <name>`
- Delete service: `kubectl delete service <name>`
## Namespaces
- Create namespace: `kubectl create namespace <name>`
- Get namespaces: `kubectl get namespaces`
- Delete namespace: `kubectl delete namespace <name>`
## Apply YAML
- Apply file: `kubectl apply -f <file.yaml>`
- Delete from file: `kubectl delete -f <file.yaml>`
## Other
- Port forward: `kubectl port-forward <pod> 8080:80`
- Get events: `kubectl get events`
- Proxy API: `kubectl proxy`
For more, refer to official docs: https://kubernetes.io/docs/
+82
View File
@@ -0,0 +1,82 @@
# MicroK8s Cheatsheet
MicroK8s is a lightweight, single-package Kubernetes distribution developed by Canonical for development, IoT, and edge computing. It runs on Linux and is easy to install via snap.
## Installation
- Install MicroK8s: `sudo snap install microk8s --classic`
- Add user to group: `sudo usermod -a -G microk8s $USER` (then relogin)
- Alias kubectl: `alias kubectl='microk8s kubectl'`
- Verify: `microk8s status`
## Basic Operations
- Start MicroK8s: `microk8s start`
- Stop MicroK8s: `microk8s stop`
- Check status: `microk8s status --wait-ready`
- Reset cluster: `microk8s reset` (caution: deletes all data)
## Add-ons
- List available add-ons: `microk8s status`
- Enable add-on: `microk8s enable <add-on>` (e.g., `dns`, `dashboard`, `registry`, `istio`, `storage`)
- Disable add-on: `microk8s disable <add-on>`
- Common add-ons: dns (required for pods), dashboard (Kubernetes Dashboard), helm3, ingress, metrics-server
## Kubectl Commands
- Use `microk8s kubectl` for all kubectl commands
- Get nodes: `microk8s kubectl get nodes`
- Get pods: `microk8s kubectl get pods -A`
- Describe pod: `microk8s kubectl describe pod <pod-name> -n <namespace>`
- Logs: `microk8s kubectl logs <pod-name> -n <namespace>`
- Exec: `microk8s kubectl exec -it <pod-name> -n <namespace> -- /bin/bash`
- Apply YAML: `microk8s kubectl apply -f <file.yaml>`
- Delete: `microk8s kubectl delete -f <file.yaml>`
## Clustering
- Generate join token on master: `microk8s add-node`
- Join from worker: `microk8s join <master-ip>:<port>/<token>`
- Remove node: `microk8s remove-node <node-name>`
- Leave cluster: `microk8s leave` (on worker)
## Dashboard Access
- Enable dashboard: `microk8s enable dashboard`
- Get token: `microk8s kubectl -n kube-system describe secret $(microk8s kubectl -n kube-system get secret | grep default-token | cut -d " " -f1)`
- Proxy: `microk8s dashboard-proxy` (access at https://127.0.0.1:10443)
## Helm
- Enable Helm: `microk8s enable helm3`
- Alias: `alias helm='microk8s helm3'`
- Install chart: `microk8s helm3 install <name> <chart>`
## Networking and Ingress
- Enable ingress: `microk8s enable ingress`
- Create ingress resource for services
## Storage
- Enable storage: `microk8s enable storage` (provides hostpath storage class)
## Troubleshooting
- Inspect: `microk8s inspect`
- Refresh certs: `microk8s refresh-certs`
- Debug pod issues: Check logs and describe
## Security Best Practices
- Run with least privilege: Use snap's confinement.
- Enable RBAC if not default.
- Secure add-ons: Use HTTPS for dashboard, authenticate properly.
- Scan images: Integrate with tools like Trivy for vulnerability scanning.
- Network policies: Use Kubernetes network policies for isolation.
- Secrets management: Use Kubernetes secrets, avoid plaintext.
## Advanced
- High availability: `microk8s enable ha-cluster`
- Upgrade: `sudo snap refresh microk8s --classic`
- Switch channel: `sudo snap switch microk8s --channel=1.28/stable`
- Export config: `microk8s kubectl config view --raw > kubeconfig.yaml`
For more details, refer to official docs: https://microk8s.io/docs
## Additional Add-ons
- GPU: `microk8s enable gpu`
- MetalLB: `microk8s enable metallb:<ip-range>`
- Cert-Manager: `microk8s enable cert-manager`
This cheatsheet is compiled from official MicroK8s documentation (https://microk8s.io/docs/commands) and community sources."
+96
View File
@@ -0,0 +1,96 @@
# Podman Cheatsheet
Podman is a daemonless container engine for running OCI containers on Linux.
It is compatible with Docker commands but runs rootless by default, enhancing
security.
## Installation
- Install on Debian/Ubuntu: `sudo apt update && sudo apt install podman`
- Verify: `podman --version`
## Basic Commands
- System info: `podman info`
- Version: `podman version`
- Help: `podman --help` or `podman <command> --help`
## Images
- Search for images: `podman search <term>` (e.g., `podman search nginx`)
- Pull an image: `podman pull <image>:<tag>` (e.g., `podman pull docker.io/library/nginx:latest`)
- List local images: `podman images` or `podman image ls`
- Inspect image: `podman inspect <image>`
- Remove image: `podman rmi <image-id or name>`
- Build image from Containerfile/Dockerfile: `podman build -t <name>:<tag> .`
- Save image to tar: `podman save -o <file.tar> <image>`
- Load image from tar: `podman load -i <file.tar>`
## Containers
- Run a container: `podman run -d --name <name> -p <host-port>:<container-port>
<image>` (detached, named, port mapping)
- Run interactive: `podman run -it <image> /bin/sh`
- List running containers: `podman ps`
- List all containers (including stopped): `podman ps -a`
- Inspect container: `podman inspect <container>`
- View logs: `podman logs <container>` or `podman logs -f <container>` (follow)
- Exec into running container: `podman exec -it <container> <command>` (e.g., `/bin/bash`)
- Stop container: `podman stop <container>`
- Start stopped container: `podman start <container>`
- Restart container: `podman restart <container>`
- Remove container: `podman rm <container>` (add `-f` to force)
- Copy files to container: `podman cp <local-path> <container>:<container-path>`
- Copy files from container: `podman cp <container>:<container-path> <local-path>`
## Volumes
- Create volume: `podman volume create <name>`
- List volumes: `podman volume ls`
- Inspect volume: `podman volume inspect <name>`
- Remove volume: `podman volume rm <name>`
- Run with volume: `podman run -v <volume-name>:<mount-path> <image>`
- Run with bind mount: `podman run -v <host-path>:<container-path> <image>`
## Pods (Multi-Container Applications)
- Create pod: `podman pod create --name <pod-name> -p <port>`
- List pods: `podman pod ls`
- Inspect pod: `podman pod inspect <pod>`
- Run container in pod: `podman run -d --pod <pod-name> <image>`
- Stop pod: `podman pod stop <pod>`
- Remove pod: `podman pod rm <pod>`
## Networks
- Create network: `podman network create <name>`
- List networks: `podman network ls`
- Inspect network: `podman network inspect <name>`
- Remove network: `podman network rm <name>`
- Run with network: `podman run --network <name> <image>`
## Kubernetes Compatibility
- Generate Kubernetes YAML from pod/container: `podman generate kube <pod/container> > pod.yaml`
- Play Kubernetes YAML: `podman play kube <yaml-file>`
- Stop and remove from YAML: `podman play kube --down <yaml-file>`
## Cleanup
- Remove all stopped containers: `podman rm $(podman ps -q -a)`
- Remove unused images: `podman rmi $(podman images -q -f dangling=true)`
- Prune everything: `podman system prune -f`
## Security Best Practices
- Run rootless: Podman defaults to rootless mode for non-root users, reducing attack surface.
- Use --privileged only when necessary; prefer specific capabilities with --cap-add.
- Secure images: Pull from trusted registries, scan with tools like Trivy.
- Least privilege: Use --security-opt label=disable if needed, but avoid.
- Secrets: Use podman secret create and --secret for sensitive data, never hardcode.
## Advanced
- Auto-update containers: `podman auto-update`
- Remote access: `podman --remote <command>` (setup with podman system connection)
- Machine (for macOS/Windows): `podman machine init`, `podman machine start`
For more details, refer to official docs: https://podman.io/docs
## Podman Compose (requires podman-compose installed)
- Install: `pip install podman-compose`
- Up: `podman-compose up -d`
- Down: `podman-compose down`
This cheatsheet is compiled from official Podman documentation and reliable sources like Red Hat Developer (https://developers.redhat.com/cheat-sheets/podman-cheat-sheet)."
+361
View File
@@ -0,0 +1,361 @@
# Red Hat Satellite 6: Ubuntu Repository Integration Cheat Sheet
## Prerequisites
### System Requirements
- Red Hat Satellite 6.x installed and configured
- Administrative access to Satellite server
- Network connectivity to Ubuntu repositories
- Sufficient storage space for repository synchronization
### Required Packages
```bash
# Ensure these packages are installed on Satellite server
yum install -y pulp-deb-plugins
katello-service restart
```
## Configuration Steps
### 1. Enable Ubuntu Content Support
#### Via Web UI
1. Navigate to **Administer****Settings****Content**
2. Set **Restrict Composite Content View** to `No`
3. Enable **Unprotected Repository** if needed
#### Via Hammer CLI
```bash
# Configure content settings
hammer settings set --name restrict_composite_content_view --value false
```
### 2. Create Ubuntu Product
#### Via Web UI
1. **Content****Products****Create Product**
2. Fill in details:
- **Name**: Ubuntu 20.04 LTS
- **Label**: ubuntu_2004_lts
- **Description**: Ubuntu 20.04 LTS repositories
#### Via Hammer CLI
```bash
# Create Ubuntu product
hammer product create \
--name "Ubuntu 20.04 LTS" \
--label "ubuntu_2004_lts" \
--description "Ubuntu 20.04 LTS repositories" \
--organization "Default Organization"
```
### 3. Add Ubuntu Repositories
#### Main Ubuntu Repository
```bash
# Add main Ubuntu repository
hammer repository create \
--name "Ubuntu 20.04 Main" \
--label "ubuntu_2004_main" \
--product "Ubuntu 20.04 LTS" \
--content-type "deb" \
--url "http://archive.ubuntu.com/ubuntu" \
--deb-releases "focal" \
--deb-components "main,restricted" \
--deb-architectures "amd64" \
--organization "Default Organization"
```
#### Universe Repository
```bash
# Add Universe repository
hammer repository create \
--name "Ubuntu 20.04 Universe" \
--label "ubuntu_2004_universe" \
--product "Ubuntu 20.04 LTS" \
--content-type "deb" \
--url "http://archive.ubuntu.com/ubuntu" \
--deb-releases "focal" \
--deb-components "universe" \
--deb-architectures "amd64" \
--organization "Default Organization"
```
#### Security Updates
```bash
# Add Security repository
hammer repository create \
--name "Ubuntu 20.04 Security" \
--label "ubuntu_2004_security" \
--product "Ubuntu 20.04 LTS" \
--content-type "deb" \
--url "http://security.ubuntu.com/ubuntu" \
--deb-releases "focal-security" \
--deb-components "main,restricted,universe,multiverse" \
--deb-architectures "amd64" \
--organization "Default Organization"
```
#### Updates Repository
```bash
# Add Updates repository
hammer repository create \
--name "Ubuntu 20.04 Updates" \
--label "ubuntu_2004_updates" \
--product "Ubuntu 20.04 LTS" \
--content-type "deb" \
--url "http://archive.ubuntu.com/ubuntu" \
--deb-releases "focal-updates" \
--deb-components "main,restricted,universe,multiverse" \
--deb-architectures "amd64" \
--organization "Default Organization"
```
### 4. Synchronize Repositories
#### Immediate Synchronization
```bash
# Synchronize specific repository
hammer repository synchronize \
--name "Ubuntu 20.04 Main" \
--product "Ubuntu 20.04 LTS" \
--organization "Default Organization"
# Synchronize all repositories in product
hammer product synchronize \
--name "Ubuntu 20.04 LTS" \
--organization "Default Organization"
```
#### Schedule Synchronization
```bash
# Create sync plan
hammer sync-plan create \
--name "Ubuntu Daily Sync" \
--description "Daily Ubuntu repository sync" \
--interval "daily" \
--sync-date "2024-01-01 02:00:00" \
--organization "Default Organization"
# Add product to sync plan
hammer product set-sync-plan \
--name "Ubuntu 20.04 LTS" \
--sync-plan "Ubuntu Daily Sync" \
--organization "Default Organization"
```
### 5. Create Content View
#### Via Hammer CLI
```bash
# Create content view
hammer content-view create \
--name "Ubuntu 20.04 CV" \
--description "Ubuntu 20.04 LTS Content View" \
--organization "Default Organization"
# Add repositories to content view
hammer content-view add-repository \
--name "Ubuntu 20.04 CV" \
--repository "Ubuntu 20.04 Main" \
--product "Ubuntu 20.04 LTS" \
--organization "Default Organization"
hammer content-view add-repository \
--name "Ubuntu 20.04 CV" \
--repository "Ubuntu 20.04 Universe" \
--product "Ubuntu 20.04 LTS" \
--organization "Default Organization"
hammer content-view add-repository \
--name "Ubuntu 20.04 CV" \
--repository "Ubuntu 20.04 Security" \
--product "Ubuntu 20.04 LTS" \
--organization "Default Organization"
hammer content-view add-repository \
--name "Ubuntu 20.04 CV" \
--repository "Ubuntu 20.04 Updates" \
--product "Ubuntu 20.04 LTS" \
--organization "Default Organization"
```
#### Publish Content View
```bash
# Publish content view
hammer content-view publish \
--name "Ubuntu 20.04 CV" \
--description "Initial Ubuntu 20.04 publication" \
--organization "Default Organization"
```
### 6. Create Activation Key
```bash
# Create activation key
hammer activation-key create \
--name "ubuntu_2004_key" \
--description "Ubuntu 20.04 LTS Activation Key" \
--lifecycle-environment "Library" \
--content-view "Ubuntu 20.04 CV" \
--organization "Default Organization"
# Add subscriptions to activation key
hammer activation-key add-subscription \
--name "ubuntu_2004_key" \
--subscription "Ubuntu 20.04 LTS" \
--organization "Default Organization"
```
## Client Configuration
### 1. Install Katello Agent on Ubuntu Client
```bash
# Download and install katello-ca-consumer
wget https://satellite.example.com/pub/katello-ca-consumer-latest.noarch.rpm
alien -i katello-ca-consumer-latest.noarch.rpm
# Register with Satellite
subscription-manager register \
--org="Default_Organization" \
--activationkey="ubuntu_2004_key" \
--serverurl=https://satellite.example.com:443/rhsm \
--baseurl=https://satellite.example.com/pulp/repos
```
### 2. Configure APT Sources
```bash
# Create Satellite sources list
cat > /etc/apt/sources.list.d/satellite.list << 'EOF'
deb https://satellite.example.com/pulp/deb/Default_Organization/Library/Ubuntu_20_04_CV/focal main restricted
deb https://satellite.example.com/pulp/deb/Default_Organization/Library/Ubuntu_20_04_CV/focal universe
deb https://satellite.example.com/pulp/deb/Default_Organization/Library/Ubuntu_20_04_CV/focal-security main restricted universe multiverse
deb https://satellite.example.com/pulp/deb/Default_Organization/Library/Ubuntu_20_04_CV/focal-updates main restricted universe multiverse
EOF
# Update package cache
apt update
```
## Monitoring and Maintenance
### Check Synchronization Status
```bash
# List all repositories with sync status
hammer repository list \
--product "Ubuntu 20.04 LTS" \
--organization "Default Organization"
# Check specific repository sync status
hammer repository info \
--name "Ubuntu 20.04 Main" \
--product "Ubuntu 20.04 LTS" \
--organization "Default Organization"
```
### View Sync History
```bash
# Show sync history
hammer task list \
--search "label = Actions::Katello::Repository::Sync" \
--organization "Default Organization"
```
### Monitor Storage Usage
```bash
# Check repository sizes
hammer repository list \
--product "Ubuntu 20.04 LTS" \
--organization "Default Organization" \
--fields "Name,Size"
```
## Troubleshooting
### Common Issues and Solutions
#### Repository Sync Failures
```bash
# Check sync task details
hammer task info --id TASK_ID
# Retry failed sync
hammer repository synchronize \
--name "Ubuntu 20.04 Main" \
--product "Ubuntu 20.04 LTS" \
--organization "Default Organization"
```
#### GPG Key Issues
```bash
# Import Ubuntu GPG keys
hammer gpg create \
--key "$(curl -s https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x871920D1991BC93C)" \
--name "Ubuntu Archive Automatic Signing Key" \
--organization "Default Organization"
```
#### Client Registration Issues
```bash
# Clean client registration
subscription-manager clean
rm -rf /etc/pki/consumer/
subscription-manager register --org="Default_Organization" --activationkey="ubuntu_2004_key"
```
### Log Files
```bash
# Satellite server logs
tail -f /var/log/foreman/production.log
tail -f /var/log/messages
# Pulp logs
tail -f /var/log/httpd/pulp_access.log
tail -f /var/log/httpd/pulp_error.log
```
## Best Practices
### Security
- Use HTTPS for all repository URLs
- Regularly update GPG keys
- Implement proper access controls
- Monitor for security updates
### Performance
- Schedule syncs during off-peak hours
- Use local mirrors when possible
- Monitor disk space regularly
- Configure appropriate retention policies
### Maintenance
- Regularly publish new content view versions
- Clean up old content view versions
- Monitor sync failures and resolve promptly
- Keep activation keys organized and documented
## Quick Reference Commands
```bash
# List all products
hammer product list --organization "Default Organization"
# List repositories in a product
hammer repository list --product "Ubuntu 20.04 LTS" --organization "Default Organization"
# Sync all repositories
hammer product synchronize --name "Ubuntu 20.04 LTS" --organization "Default Organization"
# Publish content view
hammer content-view publish --name "Ubuntu 20.04 CV" --organization "Default Organization"
# List activation keys
hammer activation-key list --organization "Default Organization"
# Check system registration
hammer host list --organization "Default Organization"
```
This cheat sheet provides a complete workflow for integrating Ubuntu repositories into Red Hat Satellite 6, from initial setup through client configuration and ongoing maintenance.
+6 -1
View File
@@ -61,4 +61,9 @@ Stratis supports encrypted pools (available in RHEL 9+ and confirmed for 10).
- Resources: Red Hat Documentation (Chapter on Stratis in Managing File Systems), stratis-storage.github.io. - Resources: Red Hat Documentation (Chapter on Stratis in Managing File Systems), stratis-storage.github.io.
- Common error: If pool not found, run `stratis daemon rediscover`. - Common error: If pool not found, run `stratis daemon rediscover`.
For more details, refer to `man stratis` or Red Hat's official docs. ## Troubleshooting
- Service issues: `journalctl -u stratisd`
- Rediscover devices: `sudo stratis daemon rediscover`
- Encryption unlock: `sudo stratis pool unlock`
For more details, refer to `man stratis` or Red Hat's official docs (https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/9/html/managing_file_systems/setting-up-stratis-file-systems_managing-file-systems)."
+36
View File
@@ -0,0 +1,36 @@
# Tmux Cheatsheet
## Basics
- Start new session: `tmux` or `tmux new -s session_name`
- Attach to session: `tmux attach -t session_name`
- List sessions: `tmux ls`
- Detach from session: Prefix + d
## Prefix Key
- Default: Ctrl-b (C-b)
## Windows (Tabs)
- Create window: Prefix + c
- Next window: Prefix + n
- Previous window: Prefix + p
- Rename window: Prefix + ,
- Kill window: Prefix + &amp;
## Panes (Splits)
- Split horizontally: Prefix + %
- Split vertically: Prefix + &quot;
- Navigate panes: Prefix + arrow keys
- Resize pane: Prefix + hold arrow
- Kill pane: Prefix + x
- Zoom pane: Prefix + z
## Copy Mode
- Enter copy mode: Prefix + [
- Exit: q
- Copy: Space to start, Enter to copy
## Other
- Reload config: Prefix + r (after binding in .tmux.conf)
- Kill session: `tmux kill-session -t session_name`
Customize with ~/.tmux.conf
+135
View File
@@ -0,0 +1,135 @@
### Adding an Ubuntu Repository to Red Hat Satellite 6
Red Hat Satellite 6 is a systems management tool primarily designed for managing Red Hat Enterprise Linux (RHEL) environments, including content repositories, provisioning, and configuration. However, it can be extended to support Debian-based distributions like Ubuntu by enabling the Debian (deb) content plugin in Katello (Satellite's content management component). This allows you to sync and manage Ubuntu repositories as custom content.
**Important Notes Before Starting:**
- Satellite 6 does not natively support Ubuntu out of the box; you must enable the deb plugin, which is not enabled by default.
- This process assumes you have administrative access to a Satellite 6 server and are comfortable with CLI commands (e.g., via Hammer, Satellite's CLI tool) or the web UI.
- Ubuntu repositories are treated as custom/third-party repos. Ensure you comply with licensing and only use official Ubuntu sources to avoid security risks.
- Security considerations: Always validate repository URLs for authenticity (e.g., use HTTPS), enable GPG key verification, and apply least privilege principles when granting access to content views. Test in a non-production environment first.
- If you're managing mixed RHEL/Ubuntu environments, note that full features like OS provisioning for Ubuntu may require additional setup (e.g., with Foreman/Puppet integration).
- Based on Red Hat documentation and community discussions (e.g., Red Hat Customer Portal solutions), this may not provide seamless support compared to RHEL repos, and some features like automatic deb discovery might be limited.
Below, I'll outline the detailed steps using both the web UI and CLI (Hammer) methods. The CLI is often more efficient for scripting and automation. These steps are derived from official Red Hat guides on syncing third-party repositories (like EPEL) and enabling Debian support.
#### Step 1: Enable the Debian Content Plugin
Satellite 6 requires the deb plugin to handle Ubuntu's deb package format. This is done via the Satellite installer.
- **CLI Method (Recommended):**
Run the following on your Satellite server as root:
```
satellite-installer --foreman-proxy-content-enable-deb true --katello-enable-deb true
```
- This enables the deb plugin for both Foreman Proxy (content proxy) and Katello.
- Restart services if prompted: `systemctl restart httpd foreman-proxy`.
- Verify: Check `satellite-installer --help | grep deb` to confirm the options are set to `true`.
- **If Already Installed:** If Satellite is running, re-run the installer with the flags above. It won't disrupt existing configurations.
If the plugin isn't available, ensure your Satellite version supports it (Satellite 6.10+ is recommended; check with `rpm -q satellite`).
#### Step 2: Create a Custom Product
Products in Satellite group related repositories. Create one for Ubuntu.
- **Web UI Method:**
1. Log in to the Satellite web interface (e.g., https://your-satellite-server).
2. Navigate to **Content > Products**.
3. Click **Create Product**.
4. Enter details:
- Name: e.g., "Ubuntu Custom".
- Label: Auto-generated or custom (e.g., "ubuntu_custom").
- GPG Key: Optional; upload Ubuntu's GPG key for verification (download from https://keyserver.ubuntu.com).
- Sync Plan: Optional; select or create one for automated syncing (e.g., daily).
5. Click **Save**.
- **CLI Method (Hammer):**
```
hammer product create --name "Ubuntu Custom" --organization "YourOrg" --description "Ubuntu repositories"
```
#### Step 3: Add the Ubuntu Repository to the Product
Now add the specific Ubuntu repo (e.g., for Ubuntu 22.04 "Jammy Jellyfish").
- **Key Details for Ubuntu Repo:**
- Type: Set to "deb" (enabled in Step 1).
- URL: Use an official mirror, e.g., `http://archive.ubuntu.com/ubuntu/` (prefer HTTPS if available: `https://us.archive.ubuntu.com/ubuntu/`).
- Releases: e.g., "jammy" (for main release), "jammy-updates", "jammy-security".
- Components: e.g., "main", "universe", "restricted", "multiverse".
- Architectures: e.g., "amd64" (filter to reduce sync size).
- **Web UI Method:**
1. Go to **Content > Products**, select your new product (e.g., "Ubuntu Custom").
2. In the **Repositories** tab, click **New Repository**.
3. Enter details:
- Name: e.g., "Ubuntu 22.04 Main".
- Label: Auto-generated.
- Type: "deb".
- Upstream URL: e.g., `http://archive.ubuntu.com/ubuntu/`.
- Releases: e.g., "jammy".
- Components: e.g., "main universe".
- Architectures: e.g., "amd64".
- Verify SSL: Enable if using HTTPS.
- GPG Key: Select if uploaded.
- Download Policy: "On Demand" for efficiency (downloads packages only when requested).
4. Click **Save**.
5. Repeat for additional repos (e.g., updates, security).
- **CLI Method (Hammer):**
```
hammer repository create --name "Ubuntu 22.04 Main" --product "Ubuntu Custom" --organization "YourOrg" \
--content-type "deb" --deb-releases "jammy" --deb-components "main universe" --deb-architectures "amd64" \
--url "http://archive.ubuntu.com/ubuntu/" --download-policy "on_demand"
```
#### Step 4: Sync the Repository
Syncing downloads metadata and packages from Ubuntu.
- **Web UI Method:**
1. In the products **Repositories** tab, select the repo and click **Sync Now**.
2. Monitor progress under **Content > Sync Status**.
- **CLI Method (Hammer):**
```
hammer repository synchronize --name "Ubuntu 22.04 Main" --product "Ubuntu Custom" --organization "YourOrg"
```
- For large repos, this can take time and disk space. Use `--async` for background syncing.
- Optimize: Set architectures and components to minimize data (e.g., avoid syncing "source" if not needed).
#### Step 5: Add to Content View and Publish
To make the repo available to hosts, add it to a Content View and publish.
- **Web UI Method:**
1. Go to **Content > Content Views > Create New View**.
2. Name it (e.g., "Ubuntu View"), add a description.
3. In the view, go to **Deb Content > Repositories > Add**, select your Ubuntu repo(s).
4. Click **Publish New Version** (add a comment for versioning).
- **CLI Method (Hammer):**
```
hammer content-view create --name "Ubuntu View" --organization "YourOrg"
hammer content-view add-repository --name "Ubuntu View" --organization "YourOrg" --repository "Ubuntu 22.04 Main" --product "Ubuntu Custom"
hammer content-view publish --name "Ubuntu View" --organization "YourOrg"
```
#### Step 6: Assign to Hosts or Activation Keys
- Create an Activation Key (**Content > Activation Keys**) and associate it with the Content View.
- Register Ubuntu hosts to Satellite using the activation key (install `subscription-manager` if needed, though for Debian it's via `katello-agent` or manual repo config).
- For Ubuntu clients: Configure `/etc/apt/sources.list.d/` to point to your Satellite's capsule or server (e.g., `deb https://satellite.example.com/pulp/deb/...`).
#### Troubleshooting and Best Practices
- **Common Issues:**
- Plugin not enabled: Errors like "deb content type not available" re-run the installer.
- Sync failures: Check URLs, firewalls, and proxy settings. Use `hammer repository info` for details.
- No packages syncing: Ensure components/releases match Ubuntu's structure.
- Disk space: Ubuntu repos are large; monitor `/var/lib/pulp`.
- **Security Best Practices:**
- Use HTTPS for repo URLs where possible.
- Enable GPG verification to prevent tampered packages.
- Apply input validation in any scripts (e.g., sanitize URLs).
- Least privilege: Restrict content views to specific organizations/locations.
- Recommend penetration testing for custom repos in production.
- **Efficiency Tips:** Use "On Demand" download policy to save resources. Schedule syncs via Sync Plans.
- **Limitations:** Satellite's deb support is basic compared to RHEL; for advanced Ubuntu management, consider tools like Landscape or Foreman standalone.
- **Further Reading:** Refer to Red Hat Customer Portal articles like "How to sync Ubuntu repositories in Red Hat Satellite 6?" (Solution 6930591) or "How to add Custom Repository to the Content View" for visuals and updates.
If you encounter errors or need help with a specific Satellite version, provide more details for tailored advice. For hands-on implementation, I can guide you through creating scripts or configs if needed.
+15 -1
View File
@@ -61,4 +61,18 @@ This is a quick reference guide for common Vim commands. Vim has several modes:
- Record macros: `q{letter}` to start, `q` to stop, `@{letter}` to replay. - Record macros: `q{letter}` to start, `q` to stop, `@{letter}` to replay.
- Vim is highly customizable via `.vimrc`. - Vim is highly customizable via `.vimrc`.
For more, type `:help` in Vim! ## Advanced Commands
- `:e filename`: Open a file
- `:bd`: Close current buffer
- `:sp` / `:vsp`: Split horizontal / vertical
- `Ctrl + ]` : Jump to tag (with ctags)
- `q:` : Open command history
- `:%s/old/new/gc` : Replace with confirmation
## Plugins and Extensions
- Popular plugins: NERDTree for file exploration, vim-fugitive for Git integration.
- Install with Vim-plug or Pathogen.
Sources: Based on https://devhints.io/vim and other web resources.
For more, type `:help` in Vim!