yum — RHEL / CentOS / Fedora package manager across all 5 shells
Equivalents in every shell
sudo yum install nginxThe Red Hat-family equivalent of apt. On RHEL 8+ / Fedora 22+ / Amazon Linux 2023, `yum` is a compatibility shim that delegates to `dnf` (next-gen rewrite with better dep resolution + parallel downloads). Core verbs: `yum install <pkg>`, `yum remove <pkg>`, `yum update [<pkg>]` (= `apt upgrade`, NOT `apt update` — this is the source of endless confusion between teams switching distros), `yum check-update` (refresh + show what's upgradable), `yum search <q>`, `yum info <pkg>`, `yum list installed`, `yum history list` (audit log of every install / remove), `yum history undo <n>` (revert a specific transaction — a feature apt lacks).
sudo yum install nginxSame external. RHEL / CentOS / Amazon Linux ship bash as default but zsh from EPEL works identically. The oh-my-zsh `dnf` plugin (which also handles yum) provides shorthand aliases (`dnfi` = `dnf install`). On Fedora 22+, prefer `dnf` directly — the `yum` wrapper still works but emits a deprecation note. `yum`-vs-`dnf` semantic differences are subtle: `dnf` reports better dep-conflict errors, parallelizes downloads, and the metadata cache lives in `/var/cache/dnf/` instead of `/var/cache/yum/`.
sudo yum install nginxSame external. Fish on RHEL needs EPEL: `sudo yum install epel-release && sudo yum install fish`. Once fish is the user shell, `yum` commands work identically to bash. Fish completion for `yum` / `dnf` ships with fish core. Fish-specific note: `sudo` env-preservation in fish uses `sudo --preserve-env=VAR` rather than `sudo -E` (the bash idiom) — relevant when piping `DEBIAN_FRONTEND`-equivalent into yum (yum has no equivalent of DEBIAN_FRONTEND; use `-y` for unattended).
winget install nginxNo native pwsh yum. RHEL-family pwsh users shell out: `& sudo yum install -y <pkg>` from Linux pwsh. On Windows, `winget` / `choco` are the analogs. Important RHEL portability note: Microsoft's `dotnet-sdk` on RHEL ships via the Microsoft RPM repo + `yum install dotnet-sdk-8.0` — for installing pwsh ON RHEL the canonical commands are `sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc; sudo yum install -y https://packages.microsoft.com/config/rhel/9/packages-microsoft-prod.rpm; sudo yum install -y powershell`.
winget install nginxNo cmd-native yum. `winget` (Windows official) / `choco` (community) for Windows; `wsl sudo yum install <pkg>` for an Amazon-Linux WSL distro (not Ubuntu — apt). The `Amazon Linux 2023` WSL image (`wsl --install -d AmazonLinux2023`) gives you `dnf` natively from cmd via `wsl sudo dnf install`. No RHEL WSL image exists — RHEL clones like AlmaLinux / Rocky Linux have community WSL images but aren't in the official `wsl --list --online` registry.
Worked examples
Install a package
sudo yum install -y nginxsudo yum install -y nginxwinget install nginxwinget install nginxList available updates without installing
yum check-updateyum check-updatewinget upgradewinget upgradeShow history of installs / removes, undo the last transaction
yum history list && sudo yum history undo lastyum history list; and sudo yum history undo lastGotchas
- `yum update` is the equivalent of `apt upgrade` (upgrades installed packages), NOT `apt update` (refreshes package lists). YUM refreshes lists automatically on every command if the cache is older than `metadata_expire` (default 6 hours per `/etc/yum.conf`). Teams switching between Debian and RHEL routinely mistype `apt update` and `yum update` for each other — `yum check-update` is the correct "what would be upgraded" command (refreshes + shows upgradable list, returns exit code 100 if updates available, 0 if none).
- On RHEL 8 / 9 / Fedora 22+ / Amazon Linux 2023, `yum` is a thin wrapper that invokes `dnf` — same flags, same outputs, but `dnf` is what's actually running. New tooling should target `dnf` directly. Older RHEL / CentOS 6 / 7 systems run real `yum` (Python 2). Amazon Linux 2 is Python-2 era yum; Amazon Linux 2023 is dnf. Mixed-distro Ansible playbooks must branch on `ansible_pkg_mgr` (`yum` vs `dnf`) to handle both.
- CentOS Linux ended in Dec 2021 — replaced by CentOS Stream (rolling, upstream of RHEL) and the binary-RHEL-rebuild forks AlmaLinux and Rocky Linux. Scripts that assume `/etc/centos-release` exists fail on Stream / Alma / Rocky. Use `/etc/os-release` (the systemd-blessed standard) and check `ID` (`rhel`, `centos`, `almalinux`, `rocky`, `fedora`, `amzn`) + `VERSION_ID`. The package contents are largely identical, but the version cadence and lifecycle differ — Stream tracks ahead of RHEL by ~6 weeks.
- EPEL (Extra Packages for Enterprise Linux) is the de-facto third-party repo for RHEL-family — `htop`, `tmux`, `fish`, `nginx`, hundreds of others ship from EPEL not the base RHEL repos. Install via `sudo yum install epel-release`. On Amazon Linux 2 the equivalent is `sudo amazon-linux-extras install epel` (yes, a second package-management layer); on Amazon Linux 2023, EPEL packages must be installed from the RHEL 9 EPEL repo manually (`sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm`).
- YUM modules (introduced with dnf in RHEL 8) are a layer over packages — `dnf module list nodejs` shows available Node.js streams (16, 18, 20), `dnf module enable nodejs:20` selects which one `dnf install nodejs` will get. Without enabling a module, `dnf install nodejs` may install an EOL version because the default module is what RHEL 8's GA-time release shipped. This is the #1 cause of "I installed nodejs but it's really old" on RHEL 8/9 — check `dnf module list nodejs` first.