Sub topic 1
Know what you are running: /etc/os-release
Prerequisites
You should be comfortable in a Linux shell, know how to install software with a package manager, and understand basic systemd services. You need SSH access to a server running Ubuntu Server, Debian, or Rocky Linux.
Identifying the system
Most Linux distributions describe themselves in a file called /etc/os-release. You can load its variables into your shell and print them:
. /etc/os-release
echo "$NAME $VERSION_ID (ID=$ID, ID_LIKE=${ID_LIKE:-none})"The ID field names the distribution, such as ubuntu, debian, or rocky. The ID_LIKE field names the family it derives from. Use ID_LIKE to decide which tools to expect.
Two lineages
Ubuntu and Debian both come from the Debian project, so they report ID_LIKE=debian. Rocky Linux is RHEL-compatible, so it reports ID_LIKE containing rhel. The family decides which package tools and conventions apply.
Release cadence and support lifecycles
Ubuntu Server LTS releases every two years. Standard security support lasts five years, and Ubuntu Pro extends it to ten. Debian stable releases about every two years, with full security support for about three years, followed by Long Term Support. Rocky Linux tracks RHEL and supports each major version for about ten years.
Check the end-of-support date before you choose a release. A release that ends support during the life of the service forces a migration.
Package management side by side
| Task | Debian or Ubuntu | Rocky Linux |
|---|---|---|
| Refresh package index | `sudo apt update` | `sudo dnf check-update` |
| Install a package | `sudo apt install nginx` | `sudo dnf install nginx` |
| Show package details | `apt policy nginx` | `dnf info nginx` |
| Remove a package | `sudo apt remove nginx` | `sudo dnf remove nginx` |
Exercise
A host reports ID_LIKE="rhel centos fedora". Which package manager should you use, and why?
Show answer
Use dnf with rpm. The ID_LIKE value contains rhel, so the host belongs to the RHEL family.