DNF Package Management Basics
Applies to CentOS Stream 9 & 10 / AlmaLinux 9.x & 10.x / Rocky Linux 9.x & 10.x
DNF (Dandified YUM) is the default package manager for the EL 9 series, replacing YUM from the EL 7 era. This article will help you master the most common DNF operations for everyday use.
What You Will Learn
Section titled “What You Will Learn”- Search, install, update, and remove packages
- View installed packages and package information
- Manage the package cache
- Understand the relationship between DNF and YUM
Prerequisites
Section titled “Prerequisites”- A system with EL 9.x installed (physical or virtual machine)
- A user account with
sudoprivileges - The system is connected to the internet
Basic Operations
Section titled “Basic Operations”Searching for Packages
Section titled “Searching for Packages”Use dnf search to find packages in the repositories:
$ dnf search nginxExample output:
Last metadata expiration check: 2:15:30 ago on Mon 24 Mar 2026.======================== Name Exactly Matched: nginx ========================nginx.x86_64 : A high performance web server and reverse proxy server==================== Name & Summary Matched: nginx ====================nginx-mod-http-perl.x86_64 : Nginx HTTP perl modulenginx-mod-stream.x86_64 : Nginx stream modulesInstalling Packages
Section titled “Installing Packages”-
View package information (optional but recommended)
View detailed information about the nginx package $ dnf info nginx -
Install the package
Install nginx $ sudo dnf install nginxDNF will display the list of packages and dependencies to be installed. Type
yto confirm. -
Verify the installation
Confirm nginx is installed $ rpm -q nginxnginx-1.24.0-1.el9.x86_64
Updating Packages
Section titled “Updating Packages”$ sudo dnf update nginx$ sudo dnf update$ dnf check-updateRemoving Packages
Section titled “Removing Packages”$ sudo dnf remove nginxViewing Installed Packages
Section titled “Viewing Installed Packages”$ dnf list installed$ dnf list installed | grep nginx$ dnf provides /usr/sbin/nginxManaging the Cache
Section titled “Managing the Cache”$ sudo dnf clean all$ sudo dnf makecacheThe Relationship Between DNF and YUM
Section titled “The Relationship Between DNF and YUM”On EL 9, the yum command is actually a symlink to dnf:
$ ls -la /usr/bin/yumlrwxrwxrwx 1 root root 5 Jan 1 00:00 /usr/bin/yum -> dnf-3You can continue using the yum command — it behaves identically to dnf. However, new users are encouraged to use dnf directly.
Common Issues
Section titled “Common Issues””No match for argument: xxx”
Section titled “”No match for argument: xxx””The package may not be in any enabled repository. Try:
$ dnf search xxx # Verify the package name is correct$ dnf repolist # View enabled repositoriesIf the package is in EPEL, refer to EPEL and Third-Party Repositories.
”This command has to be run with superuser privileges”
Section titled “”This command has to be run with superuser privileges””You need to use sudo or switch to the root user. See sudo Configuration.
EL 10 Notes: Changes in DNF 4.20
Section titled “EL 10 Notes: Changes in DNF 4.20”EL 10 still uses DNF 4 (currently 4.20), not DNF 5; day-to-day dnf commands remain compatible with EL 9. The main changes are:
| Change | EL 9 | EL 10 |
|---|---|---|
| Package manager | DNF 4 | DNF 4.20 (command-compatible) |
| AppStream modularity | Module streams available | Deprecated: no modular content is distributed; dnf module prints a deprecation warning |
| filelists metadata | Downloaded by default | Not downloaded by default (saves disk space and time) |
| DNF debug plugin | Available | Removed from dnf-plugins-core |
| versionlock | dnf-plugin-versionlock | Same; still uses versionlock.list |
dnf --versionFurther Reading
Section titled “Further Reading”- Repository Management — Add, enable, and disable software repositories
- EPEL and Third-Party Repositories — Access more packages
- RPM Basics — Low-level package management tool
- DNF official documentation:
man dnf