What is DNF?
DNF manages software on the Red Hat family of Linux distributions: Fedora, Red Hat Enterprise Linux (RHEL), CentOS Stream, Rocky Linux and AlmaLinux. It replaced the older YUM (Yellowdog Updater, Modified). Fedora switched in 2015 and RHEL in version 8. On those RHEL releases the yum command still exists and simply runs DNF, so older instructions keep working. Newer Fedora releases ship DNF5, a rewrite that keeps the same everyday commands.
Like APT on Debian systems, DNF reads package lists from configured repositories, resolves dependencies, downloads what is needed and records every change. The low-level tool underneath is rpm, which can install a single .rpm file and query installed packages (rpm -qa lists them all) but does not fetch dependencies.
Core commands
| Command | What it does |
|---|---|
sudo dnf install httpd | Installs a package and its dependencies |
sudo dnf remove httpd | Removes a package |
sudo dnf upgrade | Installs all available updates; dnf update is an alias |
dnf check-update | Lists available updates without installing them |
dnf search, dnf info | Finds packages and shows details |
dnf list installed | Lists installed packages |
dnf provides /usr/sbin/ifconfig | Finds which package supplies a file or command |
dnf repolist | Lists enabled repositories |
dnf history | Shows past transactions; sudo dnf history undo <ID> tries to reverse one |
A local package from a vendor installs with sudo dnf install ./package.rpm, which also pulls in its dependencies from the repositories.
The update versus upgrade trap
On APT systems, apt update only refreshes package lists and apt upgrade installs updates. DNF needs no separate refresh step: it refreshes repository metadata automatically when the cached copy is out of date, and both dnf update and dnf upgrade install updates. If a question asks how to apply all updates on Fedora or RHEL, sudo dnf upgrade (or update) is a complete answer on its own.
Repositories and trust
Repositories are defined in .repo files under /etc/yum.repos.d/; the directory name is a holdover from YUM. Packages are signed with GPG keys, and repository files normally have signature checking turned on (gpgcheck=1). Extra repositories, such as EPEL for RHEL-family systems, add software the base repositories lack, but each one is another source to trust and maintain. RHEL itself needs an active Red Hat subscription to receive packages from Red Hat's repositories.
Troubleshooting
- Metadata or download errors: run
sudo dnf clean all, thensudo dnf makecache, and try again. - "No match for argument": the package name is wrong or the repository that provides it is not enabled; check with
dnf searchanddnf repolist. - Name resolution or timeout errors: the problem is DNS or network access, not DNF itself.
- An update broke something: find the transaction in
dnf historyand trydnf history undo. - Error saying the command must be run with superuser privileges: add
sudo.
DNF compared with APT
| Task | Fedora, RHEL | Debian, Ubuntu |
|---|---|---|
| Install | dnf install | apt install |
| Apply updates | dnf upgrade | apt update, then apt upgrade |
| Remove | dnf remove | apt remove or apt purge |
| Package format | .rpm | .deb |
| Low-level tool | rpm | dpkg |
| Repository config | /etc/yum.repos.d/ | /etc/apt/sources.list and sources.list.d/ |
DNF on the CompTIA A+ exam
DNF falls under Core 2 (220-1202) objective 1.9, Linux basics and everyday commands. Know that it is the package manager for Red Hat-family distributions, that it installs .rpm packages, the install, remove and upgrade syntax, and that changes need sudo. If a scenario names Fedora, RHEL, Rocky Linux or CentOS, think dnf (or yum on older systems). If it names Ubuntu or Debian, think apt.