From 15369f829d9249399ba0ce3dc94cf74b8f56e8b7 Mon Sep 17 00:00:00 2001 From: duffyduck Date: Sun, 20 Sep 2026 13:22:32 +0200 Subject: [PATCH] RHEL ohne Subskription: Paketzugang dokumentiert und abgefangen Auf einem frisch installierten RHEL liefert dnf ohne Registrierung gar keine Pakete - weder podman noch git oder dialog. Das ist jetzt in beiden READMEs als Kapitel 5.1 beschrieben, mit drei Wegen: 1) kostenlose Developer Subscription for Individuals (bis 16 Systeme, kleine Produktivnutzung eingeschlossen). RHEL 9 nutzt Simple Content Access, ein "subscription-manager attach" entfaellt. 2) Installations-DVD als lokales Repository - ohne Konto und offline, aber ohne Sicherheitsupdates, daher nur als Ueberbrueckung. 3) Wechsel auf Rocky Linux oder AlmaLinux. Dazu eine Tabelle, welche Pakete das Projekt wirklich braucht und aus welchem Repository sie kommen, sowie der Hinweis, dass EPEL hier nicht weiterhilft (es setzt die Basis-Repositories voraus) - in dem Fall ist der Quadlet-Weg ohne podman-compose die Loesung. install.sh: - rhel_repo_check prueft vor der Installation, ob ueberhaupt ein nutzbares Repository vorhanden ist, und nennt sonst die drei Wege, statt den nackten dnf-Fehler stehen zu lassen. - "dialog" ist nicht mehr zwingend: es liegt in AppStream, bei Fehlschlag wird "newt" (whiptail, BaseOS) versucht. Vorher brach die Installation ab, wenn dialog fehlte - obwohl die Skripte whiptail ohnehin unterstuetzen. Co-Authored-By: Claude Opus 5 (1M context) --- README.md | 147 +++++++++++++++++++++++++++++++++++++++++++++++++- README_en.md | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++- install.sh | 43 ++++++++++++++- 3 files changed, 335 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 092ef11..adf65ce 100644 --- a/README.md +++ b/README.md @@ -223,7 +223,152 @@ sudo ./scripts/cmk-manage.sh status > lesen: kurze Image-Namen und `podman import` statt `podman load` sind die > beiden Ursachen fuer „Image unbekannt“. -### SELinux +### 5.1 Unregistriertes RHEL: woher die Pakete kommen + +Ein frisch installiertes Red Hat Enterprise Linux ohne Subskription liefert +gar nichts aus: + +``` +$ sudo dnf install -y podman +This system is not registered with an entitlement server. +You can use "rhc" or "subscription-manager" to register. +Error: There are no enabled repositories in "/etc/yum.repos.d". +``` + +Das betrifft **alle** Pakete – `podman`, `git`, `dialog`, `tar`. Es gibt drei +Wege, und `install.sh` erkennt die Lage inzwischen selbst und nennt sie. + +> Nur RHEL selbst ist betroffen. **Rocky Linux, AlmaLinux, CentOS Stream und +> Fedora** brauchen keine Registrierung – dort funktioniert `dnf` sofort. + +#### Weg 1 – kostenlose Developer-Subskription (empfohlen) + +Red Hat vergibt die *Developer Subscription for Individuals* kostenlos. Sie +gilt für **bis zu 16 Systeme**, physisch oder virtuell, und deckt neben +Entwicklung und Test ausdrücklich auch **kleine Produktivnutzung** ab. Sie wird +an die Person vergeben, nicht an die Firma. + +1. Kostenloses Konto auf anlegen +2. Auf dem Server registrieren: + +```bash +sudo subscription-manager register --username +# Kennwort wird abgefragt; alternativ --password +``` + +RHEL 9 nutzt *Simple Content Access* – die Repositories sind damit sofort +freigeschaltet, ein `subscription-manager attach` ist **nicht** mehr nötig. + +3. Kontrolle: + +```bash +sudo subscription-manager status # -> Overall Status: Current +sudo dnf repolist # -> rhel-9-for-x86_64-baseos-rpms u.a. +sudo dnf install -y git podman +``` + +Fehlen einzelne Repositories: + +```bash +sudo subscription-manager repos --list-enabled +sudo subscription-manager repos --enable=rhel-9-for-x86_64-appstream-rpms +``` + +Bei einem Firmenkonto mit Aktivierungsschlüssel stattdessen: + +```bash +sudo subscription-manager register --org --activationkey +``` + +#### Weg 2 – Installations-DVD als lokales Repository (ohne Konto, offline) + +Funktioniert ohne jede Registrierung und ohne Internet. Voraussetzung ist die +**DVD-ISO** (`rhel-9.x-x86_64-dvd.iso`, mehrere GB) – die kleine `boot.iso` +enthält keine Pakete. + +```bash +# ISO dauerhaft einhängen +sudo mkdir -p /mnt/rhel +sudo mount -o loop,ro /pfad/rhel-9.8-x86_64-dvd.iso /mnt/rhel + +# beim Booten automatisch einhängen +echo '/pfad/rhel-9.8-x86_64-dvd.iso /mnt/rhel iso9660 loop,ro,nofail 0 0' \ + | sudo tee -a /etc/fstab + +# Repository-Datei anlegen +sudo tee /etc/yum.repos.d/rhel-local.repo >/dev/null <<'REPO' +[rhel-local-baseos] +name=RHEL local - BaseOS +baseurl=file:///mnt/rhel/BaseOS +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release + +[rhel-local-appstream] +name=RHEL local - AppStream +baseurl=file:///mnt/rhel/AppStream +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release +REPO + +sudo dnf clean all +sudo dnf repolist +sudo dnf install -y podman tar openssl dialog git +``` + +> **Grenze:** Das lokale Repository enthält exakt den Stand der ISO – es gibt +> **keine Sicherheitsupdates**. Für einen dauerhaft betriebenen +> Monitoring-Server ist das kein Zustand; als Überbrückung, bis die +> Registrierung steht, ist es in Ordnung. + +#### Weg 3 – auf Rocky Linux oder AlmaLinux wechseln + +Beide sind binärkompatible Nachbauten von RHEL, dauerhaft kostenfrei und ohne +Registrierung. Dieses Projekt läuft dort unverändert – `install.sh` erkennt sie +als RHEL-Familie. + +```bash +# Rocky Linux +sudo dnf install -y git +sudo git clone https://github.com/rocky-linux/rocky-tools.git +sudo bash rocky-tools/migrate2rocky/migrate2rocky.sh -r + +# AlmaLinux +curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh +sudo bash almalinux-deploy.sh +``` + +> Vorher ein Backup bzw. einen Snapshot anlegen. Die Umstellung tauscht die +> Basispakete im laufenden System aus. + +#### Was dieses Projekt tatsächlich braucht + +| Paket | Wofür | Repository | +|---|---|---| +| `podman` | Container-Runtime | AppStream | +| `tar` | Backups und Migrations-Bundles | BaseOS | +| `openssl` | selbstsignierte Zertifikate | BaseOS | +| `dialog` | ncurses-Oberfläche | AppStream | +| `newt` (`whiptail`) | Ersatz, falls `dialog` fehlt | BaseOS | +| `curl` | Image-Download | BaseOS | +| `podman-compose` | Compose-Unterstützung | EPEL oder `pip3` | +| `git` | nur zum Klonen dieses Projekts | AppStream | + +`dialog` ist **optional**: fehlt es, nutzen die Skripte automatisch `whiptail` +aus dem Paket `newt`, das in BaseOS liegt. `install.sh` versucht genau diese +Reihenfolge und bricht deswegen nicht mehr ab. + +`git` wird nicht zwingend gebraucht – das Projekt lässt sich genauso als ZIP +oder per `scp` auf den Server bringen. + +> **EPEL hilft hier nicht:** Das EPEL-Repository setzt die Basis-Repositories +> von Red Hat voraus. Ohne Subskription oder lokales Repository lässt sich auch +> `epel-release` nicht installieren – und damit kein `podman-compose`. In dem +> Fall ist der Quadlet-Weg aus [Kapitel 6](#6-autostart-nach-einem-neustart-des-hosts-podman) +> die Lösung: er kommt ganz ohne Compose aus. + +### 5.2 SELinux Die Bind-Mounts sind in `docker-compose.yml` mit `:Z` versehen, Podman setzt dadurch automatisch den Kontext `container_file_t`. Falls Zugriffe dennoch diff --git a/README_en.md b/README_en.md index 97570c0..05e1050 100644 --- a/README_en.md +++ b/README_en.md @@ -228,7 +228,153 @@ sudo ./scripts/cmk-manage.sh status > short image names and `podman import` instead of `podman load` are the two > causes of "image not known". -### SELinux +### 5.1 Unregistered RHEL: where the packages come from + +A freshly installed Red Hat Enterprise Linux without a subscription hands out +nothing at all: + +``` +$ sudo dnf install -y podman +This system is not registered with an entitlement server. +You can use "rhc" or "subscription-manager" to register. +Error: There are no enabled repositories in "/etc/yum.repos.d". +``` + +This affects **every** package – `podman`, `git`, `dialog`, `tar`. There are +three ways out, and `install.sh` now detects the situation and names them. + +> Only RHEL itself is affected. **Rocky Linux, AlmaLinux, CentOS Stream and +> Fedora** need no registration – `dnf` works there straight away. + +#### Route 1 – free Developer Subscription (recommended) + +Red Hat hands out the *Developer Subscription for Individuals* free of charge. +It covers **up to 16 systems**, physical or virtual, and explicitly allows +**small production use** alongside development and testing. It is granted to +the individual, not to a company. + +1. Create a free account at +2. Register the server: + +```bash +sudo subscription-manager register --username +# you will be prompted for the password; alternatively --password +``` + +RHEL 9 uses *Simple Content Access* – the repositories are enabled right away, +a `subscription-manager attach` is **no longer** necessary. + +3. Verify: + +```bash +sudo subscription-manager status # -> Overall Status: Current +sudo dnf repolist # -> rhel-9-for-x86_64-baseos-rpms etc. +sudo dnf install -y git podman +``` + +If individual repositories are missing: + +```bash +sudo subscription-manager repos --list-enabled +sudo subscription-manager repos --enable=rhel-9-for-x86_64-appstream-rpms +``` + +With a corporate account and an activation key, use this instead: + +```bash +sudo subscription-manager register --org --activationkey +``` + +#### Route 2 – installation DVD as a local repository (no account, offline) + +Works without any registration and without internet access. You need the +**DVD ISO** (`rhel-9.x-x86_64-dvd.iso`, several GB) – the small `boot.iso` +contains no packages. + +```bash +# mount the ISO permanently +sudo mkdir -p /mnt/rhel +sudo mount -o loop,ro /path/rhel-9.8-x86_64-dvd.iso /mnt/rhel + +# mount it automatically at boot +echo '/path/rhel-9.8-x86_64-dvd.iso /mnt/rhel iso9660 loop,ro,nofail 0 0' \ + | sudo tee -a /etc/fstab + +# create the repository file +sudo tee /etc/yum.repos.d/rhel-local.repo >/dev/null <<'REPO' +[rhel-local-baseos] +name=RHEL local - BaseOS +baseurl=file:///mnt/rhel/BaseOS +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release + +[rhel-local-appstream] +name=RHEL local - AppStream +baseurl=file:///mnt/rhel/AppStream +enabled=1 +gpgcheck=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release +REPO + +sudo dnf clean all +sudo dnf repolist +sudo dnf install -y podman tar openssl dialog git +``` + +> **Limitation:** the local repository holds exactly the state of the ISO – +> there are **no security updates**. For a permanently running monitoring +> server that is not acceptable; as a stopgap until registration is in place it +> is fine. + +#### Route 3 – switch to Rocky Linux or AlmaLinux + +Both are binary-compatible rebuilds of RHEL, permanently free and without +registration. This project runs there unchanged – `install.sh` recognises them +as part of the RHEL family. + +```bash +# Rocky Linux +sudo dnf install -y git +sudo git clone https://github.com/rocky-linux/rocky-tools.git +sudo bash rocky-tools/migrate2rocky/migrate2rocky.sh -r + +# AlmaLinux +curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh +sudo bash almalinux-deploy.sh +``` + +> Take a backup or a snapshot first. The conversion replaces the base packages +> on a running system. + +#### What this project actually needs + +| Package | Purpose | Repository | +|---|---|---| +| `podman` | container runtime | AppStream | +| `tar` | backups and migration bundles | BaseOS | +| `openssl` | self-signed certificates | BaseOS | +| `dialog` | ncurses interface | AppStream | +| `newt` (`whiptail`) | substitute if `dialog` is missing | BaseOS | +| `curl` | image download | BaseOS | +| `podman-compose` | compose support | EPEL or `pip3` | +| `git` | only needed to clone this project | AppStream | + +`dialog` is **optional**: if it is missing, the scripts automatically use +`whiptail` from the `newt` package, which lives in BaseOS. `install.sh` tries +exactly this order and therefore no longer aborts. + +`git` is not strictly required – the project can just as well be transferred as +a ZIP file or via `scp`. + +> **EPEL does not help here:** the EPEL repository depends on Red Hat's base +> repositories. Without a subscription or a local repository you cannot even +> install `epel-release` – and therefore no `podman-compose`. In that case the +> Quadlet route from +> [chapter 6](#6-starting-automatically-after-a-host-reboot-podman) is the +> answer: it needs no compose at all. + +### 5.2 SELinux The bind mounts carry `:Z` in `docker-compose.yml`, so Podman automatically applies the `container_file_t` context. Should access still fail: diff --git a/install.sh b/install.sh index 7199c46..24b3f72 100755 --- a/install.sh +++ b/install.sh @@ -104,11 +104,52 @@ install_debian() { ok "Docker installiert: $(docker --version)" } +# Prueft, ob ueberhaupt ein nutzbares Repository vorhanden ist. Auf einem +# nicht registrierten RHEL ist das nicht der Fall - dnf meldet dann nur +# "This system is not registered with an entitlement server". +rhel_repo_check() { + local PM="$1" + $PM -q list --available podman >/dev/null 2>&1 && return 0 + err "Es ist kein nutzbares Paket-Repository vorhanden." + cat >&2 <<'EOF' + + Auf Red Hat Enterprise Linux liefert dnf ohne Subskription keine Pakete. + Drei Wege fuehren weiter (ausfuehrlich in der README, Kapitel 5.1): + + 1) Kostenlose Developer-Subskription (empfohlen, bis 16 Systeme): + Konto auf https://developers.redhat.com anlegen, dann + subscription-manager register --username + subscription-manager status + + 2) Installations-DVD als lokales Repository (ohne Konto, offline): + mount -o loop,ro /pfad/rhel-9.x-x86_64-dvd.iso /mnt/rhel + (Repo-Datei anlegen - siehe README, Kapitel 5.1) + + 3) Auf Rocky Linux oder AlmaLinux wechseln (binaerkompatibel, frei): + dieses Projekt laeuft dort unveraendert. + + Pruefen, was aktiv ist: subscription-manager status ; dnf repolist +EOF + return 1 +} + install_rhel() { log "Installiere Podman ..." local PM=dnf command -v dnf >/dev/null 2>&1 || PM=yum - $PM install -y podman tar dialog openssl || die "Podman-Installation fehlgeschlagen." + + rhel_repo_check "$PM" || die "Abbruch - bitte zuerst den Paketzugang einrichten." + + $PM install -y podman tar openssl || die "Podman-Installation fehlgeschlagen." + + # dialog ist optional: liegt in AppStream. Fehlt es, genuegt whiptail + # aus dem Paket "newt" (BaseOS) - die Skripte koennen beides. + if ! $PM install -y dialog 2>/dev/null; then + warn "'dialog' nicht verfuegbar - versuche 'newt' (whiptail)." + $PM install -y newt 2>/dev/null \ + || warn "Weder dialog noch newt installierbar - die ncurses-Oberflaeche + steht dann nicht zur Verfuegung, die Kommandozeile funktioniert weiterhin." + fi # podman-compose besorgen (Reihenfolge: Distro-Repo -> EPEL -> pip) if ! command -v podman-compose >/dev/null 2>&1; then