DNF command on CentOS 8

DNF command on CentOS 8

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.

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 dnf

next, you can check the version of DNF command on CentOS 8 with this command:

dnf --version

after 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 installed

After 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                                               @anaconda

also 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 httpd

You can now install the httpd package with the following command:

dnf install httpd

To reinstall the package httpd, run the following command:

dnf reinstall httpd

You can also see details of package httpd with the following command:

dnf info httpd

In some cases, you will require to download the packages without installing them. You can download a specific package with the following command:

dnf download httpd

Update System Packages with DNF

you can check updates for all the system packages on your system with the following command:

dnf check-update

You can now update all the packages installed in your system with the following command:

dnf update

Or if you need update specific package you can use the following command:

dnf update httpd

List DNF Repositories 

dnf repolist all

Now, list only enabled repositories on the system with the following command:

dnf repolist

Remove Packages with DNF command

You can remove any unwanted package from your system with the following command:

dnf remove httpd

Next, remove unwanted dependencies installed with the package httpd by running the following command:

dnf autoremove

You can clean all the cached packages with the following command:

dnf clean all

You 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.

 

Use of this Site is subject to express terms of use. By using this site, you signify that you agree to be bound by these