dnf & yum — Package Management on Fedora and RHEL
Use dnf and yum to install, update, and remove packages on Fedora, RHEL, CentOS, and Rocky Linux.
March 18, 20255 min read
linuxdnfyumfedorarhelpackages
dnf — Modern Fedora Package Manager
dnf (Dandified YUM) replaced yum in Fedora 22+ and RHEL 8+. It's faster with better dependency resolution.
sudo dnf install nginx # Install
sudo dnf remove nginx # Remove
sudo dnf update # Update all packages
sudo dnf search "web server" # Search packages
dnf info nginx # Package info
dnf list installed # List installed packages
sudo dnf autoremove # Remove unused dependencies
sudo dnf clean all # Clean cacheyum — Legacy (RHEL 7 / CentOS 7)
sudo yum install nginx # Same basic syntax as dnf
sudo yum remove nginx
sudo yum update
yum search "web server"
yum info nginx
sudo yum clean alldnf replaced yum in modern Red Hat-based systems. If both are available, prefer dnf — it's faster and more reliable.
rpm — Low-level (Manual .rpm Files)
sudo rpm -i package.rpm # Install a .rpm file
rpm -qa # List all installed packages
rpm -ql nginx # Files installed by package
rpm -qf /usr/bin/vim # Which package owns this file?Quick Check
Which command updates ALL packages on a Fedora system?
Exercise
On a Fedora system, search for the htop package and install it using dnf.