apt vs yum — Package Managers Compared
apt and yum (and its successor dnf) are package managers used to install and update software, but on different Linux distribution families.
Published October 2, 2026
apt manages packages on Debian and Ubuntu (.deb); yum (and its successor dnf) manages packages on RHEL, CentOS and Fedora (.rpm). Same ideas, different commands.
How it works
Both resolve dependencies from repositories. apt update refreshes the package index; yum refreshes metadata automatically.
On modern RHEL-family systems dnf replaces yum, with a compatible command line.
Try it
sudo apt update && sudo apt install nginx
sudo dnf install nginx
Practical examples
Debian/Ubuntu
sudo apt update
sudo apt install nginx
sudo apt remove nginx
sudo apt upgradeRHEL/Fedora
sudo dnf install nginx
sudo dnf remove nginx
sudo dnf upgradeSearch
apt search redis
dnf search redisWhich package owns a file
dpkg -S /usr/bin/curl
rpm -qf /usr/bin/curlCommon mistakes
- Forgetting apt update before installing.
- Mixing repositories and breaking dependencies.
- Running upgrade blindly on production.
Key takeaways
- apt = Debian family, yum/dnf = RHEL family.
- Update the index first (apt).
- Test upgrades before production.
FAQ
What replaced yum?
dnf.
What about apk and pacman?
apk (Alpine) and pacman (Arch) are other package managers.