dnf Package Manager For Red Hat Based Systems
The word dnf is actually an acronym for dandified yum. It had replaced yum as the default package manager for the Fedora operating system Fedora 22 on-wards. New dnf Package Manager for Red Hat Based Systems.
dnf package manager is considered to have the following improvements over yum:
- Better documentation for the API being used
- Faster dependency resolution for packages
- Lower memory consumption
- Run parallel operations
It is worth noting that in spite of having these advantages dnf still lacks some of the features provided. Although all operations that would be performed by a normal user would work without glitches. In this article, we will demonstrate how to install and use dnf as the primary package manager for your system.
Installing dnf Package Manager
Earlier, we could install the dnf package manager along with its dependencies directly from the EPEL repository. But the EPEL package has been removed due to some security vulnerabilities.
We’ll install the package by manually downloading it on to our Centos 7.3 system.
wget http://springdale.math.ias.edu/data/puias/unsupported/7/x86_64/dnf-conf-0.6.4-2.sdl7.noarch.rpm wget http://springdale.math.ias.edu/data/puias/unsupported/7/x86_64//dnf-0.6.4-2.sdl7.noarch.rpm wget http://springdale.math.ias.edu/data/puias/unsupported/7/x86_64/python-dnf-0.6.4-2.sdl7.noarch.rpm
We’ll use yum localinstall command to install all these RPM’s in a single command making sure there are no dependency issues.
yum localinstall python-dnf-0.6.4-2.sdl7.noarch.rpm dnf-0.6.4-2.sdl7.noarch.rpm dnf-conf-0.6.4-2.sdl7.noarch.rpm
We used yum localinstall instead of using the rpm command directly because these packages had additional dependencies which resided in the base and EPEL repositories.
Since we used yum, it was able to go out and fetch these dependencies and install them as well.
Let’s check the version of the dnf package manager
[root@sahil-centos ~]# dnf --version 0.6.4 Installed: dnf-0:0.6.4-2.sdl7.noarch at 2017-12-10 16:33 Built : at 2016-10-09 17:18 Installed: rpm-0:4.11.3-21.el7.x86_64 at 2017-05-15 09:26 Built : CentOS BuildSystem <http://bugs.centos.org> at 2016-11-05 23:37
Version of dnf installed using this method was a much older version as compared to the latest one available. We showed you how to install dnf manually because we wanted you to be aware of how to set it up on a Centos system when it was not available in any repository. For, all the examples that we will be working on, we will use a freshly installed Fedora 26 system
Now let’s go through some examples to understand how to use dnf
Check dnf version
To do this we use the dnf –version command
[root@sahil-fedora ~]# dnf --version 2.5.1 Installed: dnf-0:2.5.1-1.fc26.noarch at Sun 10 Dec 2017 12:42:52 PM GMT Built : Fedora Project at Mon 12 Jun 2017 12:39:07 PM GMT Installed: rpm-0:126.96.36.199-4.fc26.x86_64 at Sun 10 Dec 2017 12:42:43 PM GMT Built : Fedora Project at Tue 25 Apr 2017 08:07:10 PM GMT
Install a package using dnf package manager
Use the dnf install command followed by the package name. Let’s install the screen rpm to demonstrate
[root@sahil-fedora ~]# dnf install screen Is this ok [y/N]: y Downloading Packages: screen-4.6.2-1.fc26.x86_64.rpm 47 kB/s | 575 kB 00:12 Is this ok [y/N]: y Installed: screen.x86_64 4.6.2-1.fc26 Complete!
Update a package
Let’s update the dnf package manager itself to demonstrate how to update packages using dnf
[root@sahil-fedora ~]# dnf update dnf Upgraded: dnf.noarch 2.7.5-2.fc26 dnf-conf.noarch 2.7.5-2.fc26 dnf-plugins-core.noarch 2.1.5-1.fc26 dnf-yum.noarch 2.7.5-2.fc26 libdnf.x86_64 0.11.1-1.fc26 python3-dnf.noarch 2.7.5-2.fc26 python3-dnf-plugins-core.noarch 2.1.5-1.fc26 python3-hawkey.x86_64 0.11.1-1.fc26 Complete!
Now, let’s verify the currently installed version of dnf
[root@sahil-fedora ~]# dnf --version 2.7.5 Installed: dnf-0:2.7.5-2.fc26.noarch at Sun 10 Dec 2017 01:24:40 PM GMT Built : Fedora Project at Wed 29 Nov 2017 09:55:03 AM GMT Installed: rpm-0:188.8.131.52-4.fc26.x86_64 at Sun 10 Dec 2017 12:42:43 PM GMT Built : Fedora Project at Tue 25 Apr 2017 08:07:10 PM GMT
As is evident from the above output, the version of dnf has been updated to 2.7.5
Remove a package
We use the dnf remove command to remove a package followed by the package name. Let’s remove the screen package that we installed in one of our earlier examples
[root@sahil-fedora ~]# dnf remove screen Removing: screen x86_64 4.6.2-1.fc26 @updates 941 k Transaction Summary ====================== Remove 1 Package Is this ok [y/N]: y Removed: screen.x86_64 4.6.2-1.fc26 Complete!
To view information about package installations, removals and any other package management related transactions performed using the dnf package manager, we use the dnf history command
[root@sahil-fedora ~]# dnf history ID | Command line | Date and time | Action(s) | Altered ------------------------------------------------------------------------------- 4 | remove screen | 2017-12-10 05:27 | Erase | 1 3 | update dnf | 2017-12-10 05:24 | Update | 8 2 | install screen | 2017-12-10 05:22 | Install | 1 < 1 | | 2017-12-10 04:41 | Install | 627 >E
View available repositories
View list of available repositories, we use the dnf repolist command
[root@sahil-fedora ~]# dnf repolist Last metadata expiration check: 0:24:51 ago on Sun 10 Dec 2017 05:08:39 AM PST. repo id repo name status *fedora Fedora 26 - x86_64 53,912 *updates Fedora 26 - x86_64 - Updates 11,562
Update the system
To update your system to the latest versions of packages installed on the system including the kernel, we use the dnf update command
[root@sahil-fedora ~]# dnf update
Display information about a package
Display information about a package we use the dnf info command.Let’s use it to display information about the screen package
[root@sahil-fedora ~]# dnf info screen
Know Dependencies for a package Before installing
To display dependencies required by a package, we use the dnf deplist command.We’ll now list dependencies for the screen package
[root@localhost ~]# dnf deplist screen
Download a package without installing
We use the dnf download command to download a package.In the below example, we download the screen package via dnf to the /tmp directory by using the –downloaddir option to specify the download location.
[root@sahil-fedora ~]# dnf download screen --downloaddir=/tmp Last metadata expiration check: 2:51:48 ago on Sun 10 Dec 2017 05:08:39 AM PST. screen-4.6.2-1.fc26.x86_64.rpm
In addition to the examples we discussed here, the dnf package manager offers nearly all the features and options that are available with yum. dnf package manager is replacement for yum in upcoming version of Red Hat releases. There is speculation as to the future of the project but we are confident that it may find it’s place in a future release of Red Hat.
Thanks for your wonderful Support and Encouragement
- Do Not Miss Interesting and Important Articles: Signin Now
- Download free PDF Books : Download Anything and Everything for Free
- Stay Connected with Us: Facebook Page | Twitt | Google Plus | LinkedIn | RSS feeds
- High Qualitfy Video Tutorials : All Videos
- Still You Have Question? : Ask Us
Click on above colored text to access appropriate page