A quick guide to DNF for yum users

The DNF package manager offers robust features for installing, updating, and removing packages.
286 readers like this.
Cat dropped in a box


Dandified yum, better known as DNF, is a software package manager for RPM-based Linux distributions that installs, updates, and removes packages. It was first introduced in Fedora 18 in a testable state (i.e., tech preview), but it's been Fedora's default package manager since Fedora 22.

Since it is the next-generation version of the traditional yum package manager, it has more advanced and robust features than you'll find in yum. Some of the features that distinguish DNF from yum are:

  • Dependency calculation based on modern dependency-solving technology
  • Optimized memory-intensive operations
  • The ability to run in Python 2 and Python 3
  • Complete documentation available for Python APIs

DNF uses hawkey libraries, which resolve RPM dependencies for running queries on client machines. These are built on top of libsolv, a package-dependency solver that uses a satisfiability algorithm. You can find more details on the algorithm in libsolv's GitHub repository.

CLI commands that differ in DNF and yum 

Following are some of the changes to yum's command-line interface (CLI) you will find in DNF.

dnf update or dnf upgrade: Executing either dnf update or dnf upgrade has the same effect in the system: both update installed packages. However, dnf upgrade is preferred since it works exactly like yum --obsoletes update.

resolvedep: This command doesn't exist in DNF. Instead, execute dnf provides to find out which package provides a particular file.

deplist: Yum's deplist command, which lists RPM dependencies, was removed in DNF because it uses the package-dependency solver algorithm to solve the dependency query.

dnf remove <package>: You must specify concrete versions of whatever you want to remove. For example, dnf remove kernel will delete all packages called "kernel," so make sure to use something like dnf remove kernel-4.16.x.

dnf history rollback: This check, which undoes transactions after the one you specifiy, was dropped since not all the possible changes in the RPM Database Tool are stored in the history of the transaction.

--skip-broken: This install command, which checks packages for dependency problems, is triggered in yum with --skip-broken. However, now it is part of dnf update by default, so there is no longer any need for it.

-b, --best: These switches select the best available package versions in transactions. During dnf upgrade, which by default skips over updates that cannot be installed for dependency reasons, this switch forces DNF to consider only the latest packages. Use dnf upgrade --best.

--allowerasing: Allows erasing of installed packages to resolve dependencies. This option could be used as an alternative to the yum swap X Y command, in which the packages to remove are not explicitly defined.

For example: dnf --allowerasing install Y.

--enableplugin: This switch is not recognized and has been dropped.

DNF Automatic

The DNF Automatic tool is an alternative CLI to dnf upgrade. It can execute automatically and regularly from systemd timers, cron jobs, etc. for auto-notification, downloads, or updates.

To start, install dnf-automatic rpm and enable the systemd timer unit (dnf-automatic.timer). It behaves as specified by the default configuration file (which is /etc/dnf/automatic.conf).

# yum install dnf-automatic
# systemctl enable dnf-automatic.timer
# systemctl start dnf-automatic.timer
# systemctl status dnf-automatic.timer

Result of # systemctl enable dnf-automatic.timer

Other timer units that override the default configuration are listed below. Select the one that meets your system requirements.

  • dnf-automatic-notifyonly.timer: Notifies the available updates
  • dnf-automatic-download.timer: Downloads packages, but doesn't install them
  • dnf-automatic-install.timer: Downloads and installs updates

Basic DNF commands useful for package management

# yum install dnf: This installs DNF RPM from the yum package manager.

Output of # yum install dnf

# dnf –version: This specifies the DNF version.

Output of # dnf --version

# dnf list all or # dnf list <package-name>: This lists all or specific packages; this example lists the kernel RPM available in the system.

Output of # dnf list kernel command

# dnf check-update or # dnf check-update kernel: This views updates in the system.

Output of # dnf check-update kernel

# dnf search <package-name>: When you search for a specific package via DNF, it will search for an exact match as well as all wildcard searches available in the repository.

Output of # dnf search

# dnf repolist all: This downloads and lists all enabled repositories in the system.

Output of # dnf repolist all

# dnf list --recent or # dnf list --recent <package-name>: The --recent option dumps all recently added packages in the system. Other list options are --extras, --upgrades, and --obsoletes.

Output of # dnf list --recent

# dnf updateinfo list available or # dnf updateinfo list available sec: These list all the advisories available in the system; including the sec option will list all advisories labeled "security fix."

OUtput of # dnf updateinfo list available sec

# dnf updateinfo list available sec --sec-severity Critical: This lists all the security advisories in the system marked "critical."

Output of # dnf updateinfo list available sec --sec-severity Critical

# dnf updateinfo FEDORA-2018-a86100a264 –info: This verifies the information of any advisory via the --info switch.

Output of # dnf updateinfo FEDORA

# dnf upgrade --security or # dnf upgrade --sec-severity Critical: This applies all the security advisories available in the system. With the --sec-severity option, you can include the packages with severity marked either Critical, Important, Moderate, or Low.

Output of # dnf upgrade --security


These are just a small number of DNF's features, changes, and commands. For complete information about DNF's CLI, new plugins, and hook APIs, refer to the DNF guide

Amit works in Red Hat, and is passionate about linux, cloud computing, devops etc. He is a strong believer that new innovation and technology, in a open way, can positively impact the society and change many lives.


Thank you. Great article. I've been using Fedora 28 lately and I like it. This is useful information.

Hello, excellent DNF guide, we already needed it. Thank you very much.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.