yumThe classic RPM package manager (and what it is today)
yum installs and updates RPM packages on RHEL/CentOS 7 and Amazon Linux 2. On RHEL 8+, Amazon Linux 2023 and Fedora, the yum command still exists but is a symlink to dnf, so the same commands keep working everywhere in the Red Hat family.
yum [OPTIONS] install | remove | update | check-update | search | info | whatprovides | list | history | clean [ARGS]...A legacy Amazon Linux 2 host needs jq for a deploy script. Watch yum 3 resolve the dependency step by step.
sudoInstalling changes the RPM database and system files, so it needs root.
Classic yum is a Python 2 program on top of rpm. It reads /etc/yum.conf and the .repo files in /etc/yum.repos.d, downloads each repo's repomd.xml plus the primary and filelists metadata (SQLite files) into /var/cache/yum, and loads plugins such as priorities and fastestmirror. Its depsolver works in loops: mark the package, then repeatedly process unmet dependencies ('--> Processing Dependency') until everything is satisfied. Then it downloads the RPMs, checks their GPG signatures, runs an rpm test transaction and finally the real one. A single lock file, /var/run/yum.pid, stops two yum processes running at once. Transactions are recorded in /var/lib/yum/history so they can be listed and undone. On RHEL 8+ and AL2023, /usr/bin/yum is a symlink to dnf-3, so the output looks like dnf's, the solver is libsolv and yum.conf is really dnf.conf.
install PKGInstall packages and dependenciesupdate [PKG]Update everything or the named packages (upgrade is the same in yum)check-updateList updates; exit 100 if anyremove PKGRemove packages (and anything that depends on them)search / infoFind packages by name or summary / show one package's detailswhatprovides PATHWhich package ships a file (alias: provides)list installedInstalled packages with version and source repohistory [info|undo N]Show, inspect or reverse past transactions--enablerepo / --disablerepoToggle repos for this one command--securityOnly security updates (yum-plugin-security / built in on AL2)clean allDelete cached metadata and packages-yAssume yesAssuming yum and dnf behave identically on RHEL 7On RHEL/CentOS 7 and AL2, yum is the old Python 2 yum 3 with a different solver, output and options (no --setopt=install_weak_deps, for example).
Check: ls -l /usr/bin/yum; yum --versionsudo rm /var/run/yum.pid to get past the lockAnother yum is mid-transaction. Two writers can leave duplicate or half-installed packages in the rpmdb.
Wait, or find it: ps -o pid,args -p <pid>yum update -y in a cron job on productionEvery package moves, kernels included, with no review and no reboot plan.
yum update --security -y, or patch through a reviewed windowLooking for nginx with plain yum on Amazon Linux 2It's in a disabled extras topic, so yum reports 'No package nginx available'.
sudo amazon-linux-extras install nginx1Try these on a Linux machine of your own. Each task has a hint and a solution.
The sandbox has no yum. Write the yum command that lists every available version of nginx.
Read this output and say what happened: 'No package nginx available. Error: Nothing to do'. Which system printed it?
In the sandbox, check whether a command is a symlink and to what, using /usr/bin/awk as the example (just like yum -> dnf-3).
yumThe classic RPM package manager (and what it is today)
yum installs and updates RPM packages on RHEL/CentOS 7 and Amazon Linux 2. On RHEL 8+, Amazon Linux 2023 and Fedora, the yum command still exists but is a symlink to dnf, so the same commands keep working everywhere in the Red Hat family.
yum [OPTIONS] install | remove | update | check-update | search | info | whatprovides | list | history | clean [ARGS]...A legacy Amazon Linux 2 host needs jq for a deploy script. Watch yum 3 resolve the dependency step by step.
sudoInstalling changes the RPM database and system files, so it needs root.
Classic yum is a Python 2 program on top of rpm. It reads /etc/yum.conf and the .repo files in /etc/yum.repos.d, downloads each repo's repomd.xml plus the primary and filelists metadata (SQLite files) into /var/cache/yum, and loads plugins such as priorities and fastestmirror. Its depsolver works in loops: mark the package, then repeatedly process unmet dependencies ('--> Processing Dependency') until everything is satisfied. Then it downloads the RPMs, checks their GPG signatures, runs an rpm test transaction and finally the real one. A single lock file, /var/run/yum.pid, stops two yum processes running at once. Transactions are recorded in /var/lib/yum/history so they can be listed and undone. On RHEL 8+ and AL2023, /usr/bin/yum is a symlink to dnf-3, so the output looks like dnf's, the solver is libsolv and yum.conf is really dnf.conf.
install PKGInstall packages and dependenciesupdate [PKG]Update everything or the named packages (upgrade is the same in yum)check-updateList updates; exit 100 if anyremove PKGRemove packages (and anything that depends on them)search / infoFind packages by name or summary / show one package's detailswhatprovides PATHWhich package ships a file (alias: provides)list installedInstalled packages with version and source repohistory [info|undo N]Show, inspect or reverse past transactions--enablerepo / --disablerepoToggle repos for this one command--securityOnly security updates (yum-plugin-security / built in on AL2)clean allDelete cached metadata and packages-yAssume yesAssuming yum and dnf behave identically on RHEL 7On RHEL/CentOS 7 and AL2, yum is the old Python 2 yum 3 with a different solver, output and options (no --setopt=install_weak_deps, for example).
Check: ls -l /usr/bin/yum; yum --versionsudo rm /var/run/yum.pid to get past the lockAnother yum is mid-transaction. Two writers can leave duplicate or half-installed packages in the rpmdb.
Wait, or find it: ps -o pid,args -p <pid>yum update -y in a cron job on productionEvery package moves, kernels included, with no review and no reboot plan.
yum update --security -y, or patch through a reviewed windowLooking for nginx with plain yum on Amazon Linux 2It's in a disabled extras topic, so yum reports 'No package nginx available'.
sudo amazon-linux-extras install nginx1Try these on a Linux machine of your own. Each task has a hint and a solution.
The sandbox has no yum. Write the yum command that lists every available version of nginx.
Read this output and say what happened: 'No package nginx available. Error: Nothing to do'. Which system printed it?
In the sandbox, check whether a command is a symlink and to what, using /usr/bin/awk as the example (just like yum -> dnf-3).