Operating Systems

What is DNF?

DNF (Dandified YUM) is the package manager for Fedora, Red Hat Enterprise Linux and related distributions; it installs, updates and removes .rpm packages.

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

CommandWhat it does
sudo dnf install httpdInstalls a package and its dependencies
sudo dnf remove httpdRemoves a package
sudo dnf upgradeInstalls all available updates; dnf update is an alias
dnf check-updateLists available updates without installing them
dnf search, dnf infoFinds packages and shows details
dnf list installedLists installed packages
dnf provides /usr/sbin/ifconfigFinds which package supplies a file or command
dnf repolistLists enabled repositories
dnf historyShows 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, then sudo 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 search and dnf 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 history and try dnf history undo.
  • Error saying the command must be run with superuser privileges: add sudo.

DNF compared with APT

TaskFedora, RHELDebian, Ubuntu
Installdnf installapt install
Apply updatesdnf upgradeapt update, then apt upgrade
Removednf removeapt remove or apt purge
Package format.rpm.deb
Low-level toolrpmdpkg
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.

Studying for CompTIA (Operating Systems)?

ExamWizardz turns the official objectives into a guided study plan — with practice tests, realistic PBQs, and a readiness score. Start free.

Start studying free

Related terms