How To Install DNF Package Manager In CentOS/RHEL

DNF, or Dandified Yum, which is the next major version of the Yum package manager was introduced with Fedora 18. As of Fedora 22, it has become the default package manager.

As you may know, the Fedora Linux operating system is essentially a bleeding edge testing ground for packages that may be included in RHEL/CentOS based distributions in the future.

It is therefore likely that in some future release, RHEL/CentOS will also make use of DNF rather than Yum to take advantage of the new features, so let’s take a look at what’s involved in installing and using DNF in CentOS Linux so that we can be ready for it when it’s made default.

DNF aims to address poor performance and high memory usage associated with Yum.

Installing DNF

Currently the DNF package comes from the EPEL repository, so if your Linux system is not already configured to use this repository, simply run the command below to set it up.

[root@centos7 ~]# yum install epel-release -y

Now that EPEL is ready to use, simply install the dnf package as shown below.

[root@centos7 ~]# yum install dnf -y

So we’re using a package manager to install a package manager, kind of meta. I was wondering if DNF would attempt to remove Yum during installation, but it did not and it appears that they are capable of working along side each other.

Using DNF

Now that DNF is installed we can use it in place of Yum. Most of the commands appear to be of the same syntax which makes things much easier, for example:

Installing a package

dnf install httpd

Updating a package

dnf update httpd

Viewing history

dnf history

Uninstall a package

dnf remove httpd

Check out the man page for further information.

Summary

We have seen how we can easily install DNF in CentOS/RHEL distributions of Linux, allowing us to get used to working with it before it inevitably replaces Yum in some future update, as it has already done in Fedora 22.

  1. dnf is not found in yum repo for centos 6.9

  2. seems like dnf has been removed from the epel repo… worked for me a while back on a different server. Now I get:
    ( after I did a yum clean all and then refreshed my yum packages )

    yum -y install dnf
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
    * base: mirrors.rit.edu
    * centosplus: mirrors.advancedhosters.com
    * epel: mirror.cs.princeton.edu
    * extras: mirror.math.princeton.edu
    * updates: centos.mirror.constant.com
    No package dnf available.
    Error: Nothing to do

    epel sill has:
    dnf-langpacks.noarch 0.15.1-1.el7 epel
    dnf-langpacks-conf.noarch 0.15.1-1.el7 epel
    etckeeper-dnf.noarch 1.18.5-1.el7 epel
    python-dnf-langpacks.noarch 0.15.1-1.el7 epel

    but no other dnf packages.

    looked in the http://download.fedoraproject.org/pub/epel/7/ server… didn’t check other mirrors.

    – jack

  3. It simply doesn’t work:

    $ sudo yum install epel-release -y
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    * base: mirror.airenetworks.es
    * extras: mirror.tedra.es
    * updates: mirror.airenetworks.es
    Package epel-release-7-9.noarch already installed and latest version
    Nothing to do

    $ sudo yum install dnf -y
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
    * base: mirror.airenetworks.es
    * extras: mirror.tedra.es
    * updates: mirror.airenetworks.es
    No package dnf available.
    Error: Nothing to do

    Any clue ?

  4. I forgot to say, my system is:
    Linux Kernel : Linux 3.10.0-514.26.2.el7.x86_64 x86_64
    Linux Version : CentOS Linux release 7.3.1611 (Core)

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>