DNF, a.k.a Dandified YUM, is a next generation Package Manager for RPM based Linuxes.

DNF aims at improving the bottlenecks of YUM performance, memory usages, dependency resolution, speed and lots of other factors.

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. There were ultimately three major reasons why Yum was forked into DNF. The reasons were:

  • An undocumented API: this meant more work for developers. In order for developers to do what they needed, it was often necessary to browse through the Yum code base just to be able to write a call. This meant development was very slow.
  • Python 3: Fedora was about to make the shift to Python 3 and Yum wouldn’t survive this change, whereas DNF can run using either Python 2 or 3.
  • Broken dependency solving algorithm: DNF uses a state-of-the-art satisfiability (SAT)-based dependency solver. This is the same type of dependency solver used in SUSE’s and openSUSE’s Zypper.

To put it simply, Yum is outdated and couldn’t stand up to the rigors of the modern Linux.

 

Shifting from YUM to DNF

Most of DNF commands and options you will see below are also available in YUM, and both package managers may co-exist in the same machine.

To install DNF
# yum install dnf

List Enabled DNF Repositories: the option ‘repolist‘ with dnf command, will display all enabled repositories under your system.
# dnf repolist

List all Enabled and Disabled DNF Repositories: the option ‘repolist all‘ will print all the enabled/disabled repositories under your system.
# dnf repolist all

List all Available and Installed Packages using DNF: the command “dnf list” will list all the available packages from all the repositories and installed packages on your Linux system.
# dnf list

List all Installed Packages using DNF: while the “dnf list” command shows all the available/installed packages from all the repositories. However, you have the option to list only the installed packages using option “list installed” as shown below.
# dnf list installed

List all Available Packages using DNF: similarly, the “list available” option, will list all the packages available to be installed from all the enabled repositories.
# dnf list available

Search for a Package using DNF: if incase, you’ve no idea about the package that you want install, in such situation you may use ‘search‘ option with dnf command to search for the package that matches the word or string (say nano).
# dnf search nano

See what Provides a file/sub-package? the dnf option “provides” find the name of the package that provides specific file/sub-package. For example, if you would like to find what provides ‘/bin/bash‘ on your system?
# dnf provides /bin/bash

Get Details of a Package using DNF: let’s assume you want to know the information of a package before installing it on the system, you may use “info” switch to get a detailed information about a package (say nano) as below.
# dnf info nano

Install a Package with DNF: to install a package called nano, just run the below command it will automatically resolve and install all required dependencies for package nano.
# dnf install nano

Updating a Package using DNF: you may update only a specific package (say systemd) and leave everything on the system untouched.
# dnf update systemd

Check for System Updates using DNF: check updates for all the system packages installed into the system simply as.
# dnf check-update

Update All System Packages using DNF: you may update the whole system including all the installed packages with following commands.
# dnf update
OR
# dnf upgrade

Remove/Erase a Package using DNF: to remove or erase any unwanted package (say nano), you may use “remove” or “erase” switch with dnf command to remove it.
# dnf remove nano
OR
# dnf erase nano

Remove Orphan Packages using DNF: those packages that were installed to satisfy dependency may be useless if not being used by other applications. To remove those orphan packages execute the below command.
# dnf autoremove

Remove Cached Packages using DNF: a lot of time we encounter out-of-date headers and unfinished transactions which results into error while executing dnf. We may clean all the cached packages and headers containing remote package information simply by executing.
# dnf clean all

Get Help on Specific DNF Command: you may get help of any specific dnf command (say clean) just by executing the below command.
# dnf help clean

View History of DNF: you may call dnf history to look at the list of already executed dnf commands. This way you can be aware of what was installed/removed with time stamp.
# dnf history

List all Group Packages: the command “dnf grouplist” will print all available or installed packages, if nothing is mentioned, it will list all known groups.
# dnf grouplist

Install a Group Package using DNF: to install a Group of packages bundled together as group package (say Educational Software) simply as.
# dnf groupinstall ‘Educational Software’

Update a Group Package: let’s update a Group Package (say Educational Software) by executing the below command.
# dnf groupupdate ‘Educational Software’

Remove a Group Package: we can remove the group Package (say Educational Software) as.
# dnf groupremove ‘Educational Software’

Leave a Reply

Your email address will not be published. Required fields are marked *