
In this tutorial, we review DNF Command on CentOS 8. DNF stands for Dandified YUM is a software package manager for RPM-based Linux distributions. It is used to install, update and remove packages in the CentOS operating system.
It is the default package manager of CentOS8. DNF is the next-generation version of YUM and intended to be the replacement for YUM in RPM-based systems. DNF is powerful and has robust features than you’ll find in yum. DNF makes it easy to maintain groups of packages and capable of automatically resolving dependency issues.
Table of Contents
DNF command on CentOS 8
Point: For this tutorial you need CentOS 8 with root privileges.
Install DNF
By default, DNF Command is pre-installed in CentOS 8. If not installed, you can install it by running the following command:
yum install -y dnfnext, you can check the version of DNF command on CentOS 8 with this command:
dnf --versionafter type the version command, you see output like this:
4.0.9 Installed: dnf-0:4.0.9.2-5.el8.noarch at Friday 04 October 2019 05:27:09 AM GMT Built : CentOS Buildsys <[email protected]> at Monday 13 May 2019 07:35:13 PM GMT Installed: rpm-0:4.14.2-9.el8.x86_64 at Friday 04 October 2019 05:20:17 AM GMT Built : CentOS Buildsys <[email protected]> at Saturday 11 May 2019 02:04:19 AM GMT List Installed and Available Packages with DNF
DNF command on CentOS 8 has some benefits and you can list all the installed packages on your system with the following command:
dnf list installedAfter type the list command, you should see all the installed packages in the following output:
Installed Packages NetworkManager.x86_64 1:1.14.0-14.el8 @anaconda NetworkManager-config-server.noarch 1:1.14.0-14.el8 @anaconda NetworkManager-libnm.x86_64 1:1.14.0-14.el8 @anaconda NetworkManager-team.x86_64 1:1.14.0-14.el8 @anaconda NetworkManager-tui.x86_64 1:1.14.0-14.el8 @anaconda PackageKit.x86_64 1.1.12-2.el8 @AppStream PackageKit-glib.x86_64 1.1.12-2.el8 @AppStream acl.x86_64 2.2.53-1.el8 @anaconda adcli.x86_64 0.8.2-2.el8 @anaconda at.x86_64 3.1.20-11.el8 @anaconda attr.x86_64 2.4.48-3.el8 @anaconda audit.x86_64 3.0-0.10.20180831git0047a6c.el8 @anaconda audit-libs.x86_64 3.0-0.10.20180831git0047a6c.el8 @anaconda authselect.x86_64 1.0-13.el8 @anaconda authselect-compat.x86_64 1.0-13.el8 @AppStream authselect-libs.x86_64 1.0-13.el8 @anaconda avahi-libs.x86_64 0.7-19.el8 @anaconda basesystem.noarch 11-5.el8 @anacondaalso you can list all installed and available packages with the following command:
dnf list
Search and Install Package with DNF Command
You can search any package you want to install with the following command:
dnf search httpdYou can now install the httpd package with the following command:
dnf install httpdTo reinstall the package httpd, run the following command:
dnf reinstall httpdYou can also see details of package httpd with the following command:
dnf info httpdIn some cases, you will require to download the packages without installing them. You can download a specific package with the following command:
dnf download httpdUpdate System Packages with DNF
you can check updates for all the system packages on your system with the following command:
dnf check-updateYou can now update all the packages installed in your system with the following command:
dnf updateOr if you need update specific package you can use the following command:
dnf update httpdList DNF Repositories
dnf repolist allNow, list only enabled repositories on the system with the following command:
dnf repolistRemove Packages with DNF command
You can remove any unwanted package from your system with the following command:
dnf remove httpdNext, remove unwanted dependencies installed with the package httpd by running the following command:
dnf autoremoveYou can clean all the cached packages with the following command:
dnf clean allYou can also remove the group package with the following command:
dnf groupremove 'System Tools'Conclusion
In the above tutorial, we learned how to manage packages with the DNF command on CentOS 8 operating system. If you need any information about centos 8, you can use compare CentOS 7 and CentOS 8 articles.




