dnf Command
Beginner Package Management man(1)Package manager for RPM-based distributions (Fedora, RHEL 8+)
👁 12 views
📅 Updated: Mar 15, 2026
SYNTAX
dnf [OPTION]... COMMAND [PACKAGE]...
What Does dnf Do?
dnf (Dandified YUM) is the package manager for Fedora, RHEL 8+, CentOS Stream, and Rocky/AlmaLinux. It replaces yum with better performance, dependency resolution, and a cleaner API.
dnf handles package installation, removal, upgrading, and repository management. It uses RPM packages and resolves dependencies automatically.
dnf is functionally similar to apt but for the Red Hat ecosystem. It supports groups (collections of related packages), modules (application streams), and is faster than its predecessor yum.
dnf handles package installation, removal, upgrading, and repository management. It uses RPM packages and resolves dependencies automatically.
dnf is functionally similar to apt but for the Red Hat ecosystem. It supports groups (collections of related packages), modules (application streams), and is faster than its predecessor yum.
Options & Flags
| Option | Description | Example |
|---|---|---|
| install | Install packages | sudo dnf install nginx |
| remove | Remove packages | sudo dnf remove nginx |
| update | Update packages | sudo dnf update -y |
| search | Search for packages | dnf search redis |
| info | Show package details | dnf info nginx |
| list installed | List installed packages | dnf list installed |
| group install | Install package group | sudo dnf group install "Development Tools" |
| autoremove | Remove unused dependencies | sudo dnf autoremove |
Practical Examples
#1 Install package
Installs packages with automatic confirmation.
$ sudo dnf install -y nginx php postgresql-server#2 Update system
Updates all packages to latest versions.
$ sudo dnf update -y#3 Search packages
Searches package names and summaries.
$ dnf search "web server"#4 Package info
Shows version, repository, size, and description.
$ dnf info nginx#5 Install dev tools
Installs compiler, make, and other development utilities.
$ sudo dnf group install "Development Tools"#6 List installed
Shows all installed PHP packages.
$ dnf list installed | grep phpTips & Best Practices
dnf replaces yum: dnf is the successor to yum. On RHEL 8+, yum is actually an alias for dnf. Use dnf for all new work.
Equivalent to apt: dnf install = apt install. dnf update = apt upgrade. dnf search = apt search. Same concepts, different ecosystem.
EPEL for extra packages: Many packages require EPEL repository: sudo dnf install epel-release. This adds thousands of additional packages.
Frequently Asked Questions
How do I install software on RHEL/CentOS?
sudo dnf install package_name. Use dnf search to find packages.
What is the difference between dnf and yum?
dnf replaces yum with better performance and dependency resolution. On RHEL 8+, yum is just an alias for dnf.
How do I add a repository?
sudo dnf config-manager --add-repo URL. Or install a repo RPM: sudo dnf install repo-package.
Related Commands
More Package Management Commands
Master Linux with Professional eBooks
Curated IT eBooks covering Linux, DevOps, Cloud, and more
Browse Books →