Troubleshooting

yum: command not found — use the right package manager for your system

yum only exists on Red Hat-family systems. Find out what you are running and use apt, dnf, microdnf, apk or Homebrew instead — with a translation table.

Published ~7 min read

Quick fix: yum only exists on the Red Hat family, so run cat /etc/os-release and use your system’s own package manager: apt on Debian and Ubuntu, dnf on Rocky, AlmaLinux, RHEL 8 and later and Fedora (where yum is at most an alias), microdnf in minimal Red Hat containers, apk on Alpine and Homebrew on macOS. A tutorial written for CentOS 7 needs translating, not yum installed.

yum: command not found, or sudo: yum: command not found, almost never means a broken system. It means the command came from a guide written for a different Linux family. The reverse happens just as often: apt-get: command not found on Rocky Linux, or zsh: command not found: apt on a Mac. This page tells you what you are running, gives you the equivalent of each command, and covers the package names that differ between families.

Which system am I on?

any Linux shell
grep -E '^(ID|ID_LIKE|VERSION_ID)=' /etc/os-release

# which package managers exist here (works in bash, zsh and BusyBox sh)
for c in apt apt-get dnf yum microdnf apk brew; do command -v "$c"; done
  • ID=debian, ID=ubuntu or ID_LIKE=debian → apt.
  • ID="rocky", ID="almalinux", ID="rhel", ID="centos" (Stream) or ID=fedora → dnf. Rocky and Alma also list ID_LIKE="rhel centos fedora".
  • ID=alpine → apk.
  • No /etc/os-release at all, and sw_vers prints a version → you are on macOS. Skip to macOS.

What is the yum equivalent on Ubuntu and Debian?

The Ubuntu and Debian equivalent of yum install is apt install. Refresh the package index first; yum does that on its own, apt does not.

Debian · Ubuntu
# what the tutorial says
sudo yum install -y httpd

# what you run
sudo apt update
sudo apt install -y apache2

Note the package name: the Apache web server is httpd on the Red Hat family and apache2 on Debian and Ubuntu. A straight swap of the command is often not enough. See package names that differ below, and Unable to locate package if apt cannot find a name. If the guide adds a third-party repository with add-apt-repository and that is missing too, see add-apt-repository: command not found.

apt and apt-get install from the same repositories. Use apt at the keyboard and apt-get in scripts and Dockerfiles: when apt’s output goes to a pipe it prints its own warning that its command-line interface is not stable for use in scripts.

Why is yum missing on Rocky, AlmaLinux or RHEL 9?

Since RHEL 8 the package manager is dnf, and yum survives only as a compatibility name. On Rocky Linux 9, /usr/bin/yum is a symlink to dnf, installed by a small package that is itself called yum. Every yum command from an older tutorial therefore runs unchanged as dnf:

Rocky · Alma · RHEL
ls -l /usr/bin/yum            # /usr/bin/yum -> dnf-3
sudo dnf install -y httpd     # same as: sudo yum install -y httpd

# want the old name back?
sudo dnf install -y yum

Minimal container images (rockylinux/rockylinux:9-minimal, the UBI minimal image and similar) ship neither yum nor dnf, only microdnf. It installs, removes and upgrades, but it has no search; use microdnf repoquery instead.

minimal images
microdnf install -y tar gzip
microdnf repoquery 'python3*'
microdnf clean all

What changed on Fedora with DNF5?

Fedora 41 replaced dnf with DNF5. On current Fedora the dnf5 package provides dnf, yum and even microdnf as names for itself, so the yum name still works. Most commands are identical. Three things from older guides are not:

  • dnf groupinstall is gone. Use dnf group install with the group’s ID.
  • Groups are named by ID, and the IDs are not always what you expect. Fedora’s development-tools group installs git and similar tools; the compiler and make are in c-development. On Rocky and Alma, the “Development Tools” group does contain gcc and make.
  • dnf list installed now looks for a package called “installed”. Write dnf list --installed, which also works on Rocky 9.
Fedora · Rocky · Alma
# Fedora 41 and later
sudo dnf group install -y c-development

# Rocky, Alma, RHEL 9
sudo dnf group install -y "Development Tools"

For the toolchain in general, see make: command not found.

What replaces yum on Alpine?

Alpine has neither apt nor yum. Its package manager is apk, and inside a container you are usually root, so there is no sudo either.

Alpine
apk update
apk add curl bash

# in a Dockerfile: no cache left behind in the image
RUN apk add --no-cache curl bash

Why are apt-get and yum not found on macOS?

macOS ships no package manager for open-source command-line tools. apt-get, apt and yum do not exist there, and following a Linux guide on a Mac means installing Homebrew and translating the package names. The first line below is the official install command from brew.sh: it lists what it will do and waits for you to press Return before changing anything. Download and read install.sh first if you prefer.

macOS
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Apple Silicon: put brew on the PATH, as the installer tells you to
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"

brew install wget

Run brew as your own user, never with sudo; Homebrew refuses to run as root. If the guide is really about a Linux server, run it on the server. Or, on Windows, run it inside WSL with Ubuntu, where apt is the right command.

How do yum and dnf commands translate to apt, apk and brew?

the same job, four package managers
task                          yum / dnf                  apt (Debian, Ubuntu)          apk (Alpine)              brew (macOS)
install a package             dnf install pkg            apt install pkg               apk add pkg               brew install pkg
remove a package              dnf remove pkg             apt remove pkg                apk del pkg               brew uninstall pkg
search by name                dnf search term            apt search term               apk search term           brew search term
refresh the package index     dnf makecache              apt update                    apk update                brew update
list available updates        dnf check-update           apt list --upgradable         apk version -l '<'        brew outdated
upgrade everything            dnf upgrade                apt upgrade                   apk upgrade               brew upgrade
remove unused dependencies    dnf autoremove             apt autoremove                (apk del does this)       brew autoremove
show package details          dnf info pkg               apt show pkg                  apk info -a pkg           brew info pkg
list installed packages       dnf list --installed       apt list --installed          apk list -I               brew list
which package owns a file     rpm -qf /usr/bin/dig       dpkg -S /usr/bin/dig          apk info --who-owns PATH  -
which package provides a cmd  dnf provides /usr/bin/dig  apt-file search /usr/bin/dig  apk search -x cmd:dig     -
  • Prefix the commands with sudo on a normal user account. Homebrew is the exception.
  • dnf provides searches the repositories, so it finds the package for a command you do not have yet. On Debian and Ubuntu that needs sudo apt install -y apt-file && sudo apt-file update first; dpkg -S only knows installed packages.
  • yum accepts the same subcommands as dnf on every system where it still exists, so the first column works with either name.

Which package names differ between distributions?

This is where most translated tutorials actually fail: the command is right, the name is not.

same software, different names
what you want            Debian / Ubuntu  Rocky / Alma / RHEL            Alpine
compiler, make, headers  build-essential  group "Development Tools"      build-base
                                          (Fedora: group c-development)
Python headers           python3-dev      python3-devel                  python3-dev
OpenSSL headers          libssl-dev       openssl-devel                  openssl-dev
dig, nslookup, host      bind9-dnsutils   bind-utils                     bind-tools
Apache web server        apache2          httpd                          apache2
cron daemon              cron             cronie                         cronie (or BusyBox crond)
netcat                   netcat-openbsd   nmap-ncat                      netcat-openbsd
ps, top, free            procps           procps-ng                      procps-ng

The pattern behind most of them: development headers end in -dev on Debian, Ubuntu and Alpine and in -devel on the Red Hat family. If a DNS tool is what you were after, see dig: command not found.

How do I follow a CentOS 7 tutorial today?

CentOS Linux 7 reached its end of life on 30 June 2024. Its mirrors were moved to the vault archive, so yum install on an untouched CentOS 7 machine now fails with mirror and repository errors before it gets to your package, and nothing it installs will receive security updates. The fix is not to keep that system alive, but to run the tutorial on Rocky Linux or AlmaLinux 9 and translate the handful of commands that changed:

CentOS 7 → Rocky / Alma 9
yum install pkg                    →  dnf install pkg
yum-config-manager --add-repo URL  →  dnf config-manager --add-repo URL   (needs dnf-plugins-core)
yum install epel-release           →  dnf install epel-release
                                      dnf config-manager --set-enabled crb  (many EPEL packages need it)
service nginx start                →  systemctl start nginx
chkconfig nginx on                 →  systemctl enable nginx

A command that does not exist returns exit status 127, which is how this error usually shows up in CI logs and install scripts. See exit code 127 for reading those, and sudo: command not found if it is sudo itself that is missing.

Often the simplest fix is to match the server to the tutorial instead of the other way round. A Standard KVM VPS can be installed with Debian, Ubuntu, Rocky Linux or CentOS Stream, and reinstalled with another one from the panel, so you can pick the family your guide was written for.

Another tool missing, or a directory to add to PATH for good in bash, zsh and fish? See command not found: the three causes and the fix for every tool.

Frequently asked

What is the Ubuntu equivalent of yum?

apt. Run 'sudo apt update' and then 'sudo apt install -y <package>'. Check the package name as well as the command: Red Hat's httpd is apache2 on Ubuntu, and -devel header packages are called -dev.

Has dnf replaced yum?

Yes. RHEL 8 and later, Rocky Linux and AlmaLinux use dnf, and where a yum command still exists it is a symlink to dnf that accepts the same subcommands. Fedora 41 and later use DNF5, with dnf and yum both pointing to it. The original yum only runs on CentOS 7 and RHEL 7 or older: CentOS 7 reached end of life in June 2024, and RHEL 7 is left with paid extended support only.

Can I install yum on Ubuntu?

No, and you should not try. Ubuntu and Debian have no yum package. They do package dnf and rpm for working with RPM-based systems, but software installed with them bypasses apt's database and breaks updates. Translate the commands to apt instead.

Why is there no apt-get on my Mac?

macOS is not a Linux distribution and ships no apt, apt-get or yum. Install Homebrew from brew.sh and use 'brew install <package>', running it as your own user rather than with sudo. Package names sometimes differ from the Linux ones.

Related articles

All troubleshooting