How to install and use DNF in RPM Based Distributions

How to install and use DNF in RPM Based Distributions

DNF - software manager to install, update and remove packages in RPM based distributions. It computes the dependencies and install the required packages automatically. In this article we are going to discuss about DNF, the Next Generation Package Management Utility.

Limitations of Yum

  • Dependency resolution of YUM was resolved in DNF.
  • Less automatic synchronisation of metadata and Lower memory reduction.
  • No support for extensions other than Python.
  • YUM don' t have a documented API.
  • Building new characteristic are difficult.

To Test DNF Commands

Before installing dnf on centOS, you need to setup the EPEL repo.

[root@linuxhelp ~]# yum install epel-release -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos-hcm.viettelidc.com.vn
 * updates: centos-hcm.viettelidc.com.vn
Resolving Dependencies
-->  Running transaction check
--->  Package epel-release.noarch 0:7-6 will be installed
-->  Finished Dependency Resolution
.
.
Installed:
  epel-release.noarch 0:7-6                                                                

Complete!

Now install dnf by running the following command.

[root@linuxhelp ~]# yum install dnf -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: epel.mirror.net.in
 * extras: centos-hcm.viettelidc.com.vn
 * updates: centos-hcm.viettelidc.com.vn
Resolving Dependencies
-->  Running transaction check
--->  Package dnf.noarch 0:0.6.4-2.el7 will be installed
-->  Finished Dependency Resolution
.
.
Installed:
  dnf.noarch 0:0.6.4-2.el7                                                                 

Complete!

To install a Package

After installing dnf, if you try to install any package using dnf command, it restricts. To overcome that issue, remove the epel-repo using yum command.

[root@linuxhelp ~]# yum remove epel-release -y
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
-->  Running transaction check
--->  Package epel-release.noarch 0:7-6 will be erased
-->  Finished Dependency Resolution

Dependencies Resolved
.
.
Removed:
  epel-release.noarch 0:7-6                                                                

Complete!

And then install the libsolv-0.6.11-1.el7 package from the base repository.

[root@linuxhelp ~]# yum --showduplicates --disablerepo=base list libsolv
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel: epel.mirror.net.in
 * extras: centos-hcm.viettelidc.com.vn
 * updates: centos-hcm.viettelidc.com.vn
Installed Packages
libsolv.x86_64                              0.6.11-1.el7                              @base

Now you can install the packages using dnf command.

Example command with dnf

1. Check the DNF version

To check the installed dnf version on your system.

[root@linuxhelp ~]# dnf --version
0.6.4
  Installed: dnf-0:0.6.4-2.el7.noarch at 2016-06-24 20:24
  Built    : Fedora Project at 2015-07-07 11:48

  Installed: rpm-0:4.11.3-17.el7.x86_64 at 2016-06-24 21:14
  Built    : CentOS BuildSystem < http://bugs.centos.org>  at 2015-11-20 11:15

2. List Enabled DNF Repositories

The option ‘ repolist‘ with dnf command, will display all the enabled repositories in your system.

[root@linuxhelp ~]# dnf repolist
Using metadata from Sat Jun 25 02:03:21 2016
repo id                       repo name                                                  status
base                          CentOS-7 - Base                                            9,007
extras                        CentOS-7 - Extras                                            310
mariadb                       MariaDB                                                       14
updates                       CentOS-7 - Updates                                         1,974
zabbix                        Zabbix Official Repository - x86_64                           53
zabbix-non-supported          Zabbix Official Repository non-supported - x86_64              4

3. List both Enabled and Disabled DNF Repositories

The option ‘ repolist all‘ will print both enabled and disabled repositories in your system.

[root@linuxhelp ~]# dnf repolist all
Using metadata from Sat Jun 25 02:03:21 2016
repo id                   repo name                                              status
C7.0.1406-base            CentOS-7.0.1406 - Base                                 disabled
C7.0.1406-centosplus      CentOS-7.0.1406 - CentOSPlus                           disabled
C7.0.1406-extras          CentOS-7.0.1406 - Extras                               disabled
C7.0.1406-fasttrack       CentOS-7.0.1406 - CentOSPlus                           disabled
C7.0.1406-updates         CentOS-7.0.1406 - Updates                              disabled
C7.1.1503-base            CentOS-7.1.1503 - Base                                 disabled
C7.1.1503-centosplus      CentOS-7.1.1503 - CentOSPlus                           disabled
C7.1.1503-extras          CentOS-7.1.1503 - Extras                               disabled
C7.1.1503-fasttrack       CentOS-7.1.1503 - CentOSPlus                           disabled
C7.1.1503-updates         CentOS-7.1.1503 - Updates                              disabled
base                      CentOS-7 - Base                                        enabled: 9,007
base-debuginfo            CentOS-7 - Debuginfo                                   disabled
base-source               CentOS-7 - Base Sources                                disabled
c7-media                  CentOS-7 - Media                                       disabled
centosplus                CentOS-7 - Plus                                        disabled
centosplus-source         CentOS-7 - Plus Sources                                disabled
cr                        CentOS-7 - cr                                          disabled
extras                    CentOS-7 - Extras                                      enabled:   310
extras-source             CentOS-7 - Extras Sources                              disabled
fasttrack                 CentOS-7 - fasttrack                                   disabled
mariadb                   MariaDB                                                enabled:    14
updates                   CentOS-7 - Updates                                     enabled: 1,974
updates-source            CentOS-7 - Updates Sources                             disabled
zabbix                    Zabbix Official Repository - x86_64                    enabled:    53
zabbix-non-supported      Zabbix Official Repository non-supported - x86_64      enabled:     4

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

[root@linuxhelp ~]# dnf list
Using metadata from Sat Jun 25 02:03:21 2016
Installed Packages
GConf2.x86_64                                        3.2.6-8.el7                         @System
MariaDB-client.x86_64                                10.1.14-1.el7.centos                @System
MariaDB-common.x86_64                                10.1.14-1.el7.centos                @System
MariaDB-devel.x86_64                                 10.1.14-1.el7.centos                @System
MariaDB-server.x86_64                                10.1.14-1.el7.centos                @System
MariaDB-shared.x86_64                                10.1.14-1.el7.centos                @System
ModemManager.x86_64                                  1.1.0-8.git20130913.el7             @System
ModemManager-glib.x86_64                             1.1.0-8.git20130913.el7             @System
NetworkManager.x86_64                                1:1.0.6-30.el7_2                    @System
NetworkManager-glib.x86_64                           1:1.0.6-30.el7_2                    @System
NetworkManager-libnm.x86_64                          1:1.0.6-30.el7_2                    @System
NetworkManager-libreswan.x86_64                      1.0.6-3.el7                         @System
NetworkManager-team.x86_64                           1:1.0.6-30.el7_2                    @System
.
.
.
zziplib-devel.i686                                   0.13.62-5.el7                       base   
zziplib-devel.x86_64                                 0.13.62-5.el7                       base   
zziplib-utils.x86_64                                 0.13.62-5.el7                       base   

5. List all Installed Packages using DNF

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

[root@linuxhelp ~]# dnf list installed
Zabbix Official Repository non-supported - x86_64              2.7 kB/s | 2.3 kB     00:00    
Zabbix Official Repository - x86_64                             37 kB/s |  32 kB     00:00    
CentOS-7 - Base                                                568 kB/s | 8.8 MB     00:15    
CentOS-7 - Updates                                             622 kB/s | 7.4 MB     00:12    
MariaDB                                                         57 kB/s |  91 kB     00:01    
CentOS-7 - Extras                                              592 kB/s | 467 kB     00:00    
Using metadata from Sun Jun 26 07:39:29 2016
Installed Packages
GConf2.x86_64                                     3.2.6-8.el7                           @System
MariaDB-client.x86_64                             10.1.14-1.el7.centos                  @System
MariaDB-common.x86_64                             10.1.14-1.el7.centos                  @System
.
.
zenity.x86_64                                     3.8.0-4.el7                           @System
zip.x86_64                                        3.0-10.el7                            @System
zlib.x86_64                                       1.2.7-13.el7                          @System

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

[root@linuxhelp ~]# dnf list available
Using metadata from Sun Jun 26 07:39:29 2016
Available Packages
389-ds-base.x86_64                                 1.3.4.0-32.el7_2                     updates
389-ds-base-devel.x86_64                           1.3.4.0-32.el7_2                     updates
389-ds-base-libs.x86_64                            1.3.4.0-32.el7_2                     updates
Cython.x86_64                                      0.19-3.el7                           base   
ElectricFence.i686                                 2.2.2-39.el7                         base   
ElectricFence.x86_64                               2.2.2-39.el7                         base   
GConf2.i686                                        3.2.6-8.el7                          base   
GConf2-devel.i686                                  3.2.6-8.el7                          base   
GConf2-devel.x86_64                                3.2.6-8.el7                          base   
GeoIP.i686                                         1.5.0-9.el7                          base   
GeoIP.x86_64                                       1.5.0-9.el7                          base   
GeoIP-devel.i686                                   1.5.0-9.el7                          base   
GeoIP-devel.x86_64                                 1.5.0-9.el7                          base   
.
.
zziplib-devel.x86_64                               0.13.62-5.el7                        base   
zziplib-utils.x86_64                               0.13.62-5.el7                        base   

7. Search for a Package using DNF

Incase, you’ ve no idea about the package that you want to install, use ‘ search‘ option with dnf command to search for the package that matches the word or string

[root@linuxhelp ~]# dnf search nano
Using metadata from Sun Jun 26 07:39:29 2016
====================================== N/S Matched: nano ======================================
nano.x86_64 : A small text editor

8. 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?

[root@linuxhelp ~]# dnf provides /bin/bash
Using metadata from Sun Jun 26 07:39:29 2016
bash-4.2.45-5.el7.x86_64 : The GNU Bourne Again shell
Repo        : @System

bash-4.2.46-19.el7.x86_64 : The GNU Bourne Again shell
Repo        : base

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

[root@linuxhelp ~]# dnf info nano
Using metadata from Sun Jun 26 07:39:29 2016
Installed Packages
Name        : nano
Arch        : x86_64
Epoch       : 0
Version     : 2.3.1
Release     : 10.el7
Size        : 1.6 M
Repo        : @System
Summary     : A small text editor
URL         : http://www.nano-editor.org
License     : GPLv3+
Description : GNU nano is a small and friendly text editor.

10. Install a Package with DNF

To install a package called httpd, run the below command it will automatically resolve and install all required dependencies.

[root@linuxhelp ~]# dnf install httpd
Using metadata from Sun Jun 26 07:39:29 2016
Dependencies resolved.
===============================================================================================
 Package          Arch              Version                           Repository          Size
===============================================================================================
Installing:
 httpd            x86_64            2.4.6-40.el7.centos.1             updates            2.7 M

Transaction Summary
===============================================================================================
Install  1 Package
.
.
Installed:
  httpd.x86_64 2.4.6-40.el7.centos.1                                                           

Complete!

11.To delete a Package

[root@linuxhelp ~]# dnf remove httpd
Using metadata from Sun Jun 26 07:39:29 2016
Dependencies resolved.
===============================================================================================
 Package          Arch              Version                           Repository          Size
===============================================================================================
Removing:
 httpd            x86_64            2.4.6-40.el7.centos.1             @System            9.4 M

Transaction Summary
===============================================================================================
Remove  1 Package
.
.
Removed:
  httpd.x86_64 2.4.6-40.el7.centos.1                                                           

Complete!

12. Updating a Package using DNF

You may update all the packages and also a specific package by using the ' update' option. Here it will update only the systemd package.

[root@linuxhelp ~]# dnf update systemd
Using metadata from Wed Jun 29 11:09:58 2016
Dependencies resolved.
===============================================================================================
 Package                      Arch           Version                     Repository       Size
===============================================================================================
Upgrading:
 dracut                       x86_64         033-360.el7_2.1             updates         311 k
 dracut-config-rescue         x86_64         033-360.el7_2.1             updates          50 k
 dracut-network               x86_64         033-360.el7_2.1             updates          90 k
 initscripts                  x86_64         9.49.30-1.el7_2.2           updates         429 k
 kmod                         x86_64         20-5.el7                    base            114 k
 libgudev1                    x86_64         219-19.el7_2.11             updates          66 k
.
.
Upgraded:
  dracut.x86_64 033-360.el7_2.1               dracut-config-rescue.x86_64 033-360.el7_2.1      
  dracut-network.x86_64 033-360.el7_2.1       initscripts.x86_64 9.49.30-1.el7_2.2             
  kmod.x86_64 20-5.el7                        libgudev1.x86_64 219-19.el7_2.11                 
  systemd.x86_64 219-19.el7_2.11              systemd-libs.x86_64 219-19.el7_2.11              
  systemd-python.x86_64 219-19.el7_2.11       systemd-sysv.x86_64 219-19.el7_2.11              

Complete!

13. Check for System Updates using DNF

Check updates for all the system packages installed into the system by running the following command.

[root@linuxhelp ~]# dnf check-update
Using metadata from Wed Jun 29 11:09:58 2016

ModemManager.x86_64                               1.1.0-8.git20130913.el7               base   
ModemManager-glib.x86_64                          1.1.0-8.git20130913.el7               base   
NetworkManager.x86_64                             1:1.0.6-27.el7                        base   
NetworkManager.x86_64                             1:1.0.6-29.el7_2                      updates
NetworkManager.x86_64                             1:1.0.6-30.el7_2                      updates
NetworkManager-glib.x86_64                        1:1.0.6-27.el7                        base   
NetworkManager-glib.x86_64                        1:1.0.6-29.el7_2                      updates
NetworkManager-glib.x86_64                        1:1.0.6-30.el7_2                      updates
.
.
.
linux-firmware.noarch                             20150904-43.git6ebf5d5.el7            base   
    libertas-usb8388-firmware.noarch              2:20140213-0.3.git4164c23.el7         @System
linux-firmware.noarch                             20150904-43.git6ebf5d5.el7            base   
    linux-firmware.noarch                         20140213-0.3.git4164c23.el7           @System
totem.x86_64                                      1:3.14.3-5.el7                        base   
    totem-mozplugin.x86_64                        1:3.8.2-5.el7                         @System
xorg-x11-server-Xorg.x86_64                       1.17.2-10.el7                         base   
    xorg-x11-drv-modesetting.x86_64               0.8.0-13.el7                          @System
xorg-x11-server-Xorg.x86_64                       1.17.2-10.el7                         base   
    xorg-x11-glamor.x86_64                        0.5.1-4.20140115gitfb4d046c.el7       @System

14.To Upgrade the System

To upgrade the whole system execute the below command.

[root@linuxhelp ~]# dnf update
Using metadata from Sun Jun 26 07:39:29 2016
Dependencies resolved.
===============================================================================================
 Package                                  Arch   Version                         Repository
                                                                                          Size
===============================================================================================
Installing:
 NetworkManager-libnm                     x86_64 1:1.0.6-30.el7_2                updates 498 k
 NetworkManager-team                      x86_64 1:1.0.6-30.el7_2                updates 132 k
     replacing  NetworkManager.x86_64 1:0.9.9.1-13.git20140326.4dba720.el7
 NetworkManager-wifi                      x86_64 1:1.0.6-30.el7_2                updates 160 k
     replacing  NetworkManager.x86_64 1:0.9.9.1-13.git20140326.4dba720.el7
 abrt-retrace-client                      x86_64 2.1.11-36.el7.centos            base    119 k
 adwaita-icon-theme                       noarch 3.14.1-1.el7                    base     11 M
 anaconda-core                            x86_64 21.48.22.56-5.el7.centos.1      updates 1.5 M
 anaconda-gui                             x86_64 21.48.22.56-5.el7.centos.1      updates 446 k
 anaconda-tui                             x86_64 21.48.22.56-5.el7.centos.1      updates 237 k
 boost-iostreams                          x86_64 1.53.0-25.el7                   base     60 k
 boost-thread                             x86_64 1.53.0-25.el7                   base     57 k
 check                                    x86_64 0.9.9-5.el7                     base    102 k
 compat-libcogl-pango12                   x86_64 1.14.0-3.el7                    base     27 k
 compat-libcogl12                         x86_64 1.14.0-3.el7                    base    282 k
.
.
Complete!

The default location of dnf configuration file is /etc/dnf/dnf.conf

15.To view History of DNF

To view the dnf history i.e., already executed dnf commands, type history with dnf and execute it.

[root@linuxhelp ~]# dnf history
Using metadata from Sun Jun 26 07:39:29 2016
ID     | Command line             | Date a | Action | Altere
-------------------------------------------------------------------------------
     4 | update                   | 2016-06-26 07:58 | I, O, U        |  921 EE
     3 | remove httpd             | 2016-06-26 07:52 | Erase          |    1   
     2 | install httpd            | 2016-06-26 07:50 | Install        |    1   
     1 | remove httpd             | 2016-06-26 07:49 | Erase          |    4 EE

16. To 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.

[root@linuxhelp ~]# dnf grouplist
Using metadata from Wed Jun 29 11:09:58 2016
Available environment groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   File and Print Server
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Available groups:
   Compatibility Libraries
   Console Internet Tools
   Development Tools
   Graphical Administration Tools
   Legacy UNIX Compatibility
   Scientific Support
   Security Tools
   Smart Card Support
   System Administration Tools
   System Management

17. Install a Group Package using DNF

To install a Group of packages use ' groupinstall' option.

[root@linuxhelp ~]# dnf groupinstall ' System Administration Tools' 
Using metadata from Tue Jun 28 16:01:50 2016
Dependencies resolved.
===============================================================================================
 Group                                Packages                                               
===============================================================================================
Marking installed:
 System Administration Tools          symlinks         rrdtool                        pexpect
                                      mc               dump                           xdelta
                                      screen           tree                           snapper
                                      mgetty           hardlink                       expect
                                      conman           crypto-utils                   scrub  
                                      rdist            system-storage-manager         rear   
                                      lsscsi                                                 
Is this ok [y/N]: y
Complete!

18. Update a Group Package

To update a Group Package execute the below command.

[root@linuxhelp ~]# dnf groupupdate ' System Management' 
Using metadata from Tue Jun 28 16:01:50 2016
Dependencies resolved.
===============================================================================================
 Group                  Packages                                                             
===============================================================================================
Marking installed:
 System Management      freeipmi-ipmidetectd      ipmitool                   fence-agents-all
                        freeipmi                  freeipmi-bmc-watchdog      watchdog        
                        OpenIPMI                  openhpi                                    
Is this ok [y/N]: y
Complete!
[root@linuxhelp ~]#

19. Remove a Group Package

To remove the group Package use ' groupremove' option.

[root@linuxhelp ~]# dnf groupremove ' System Management' 
Using metadata from Tue Jun 28 16:01:50 2016
Dependencies resolved.
===============================================================================================
 Group                  Packages                                                             
===============================================================================================
Marking removed:
 System Management      freeipmi-ipmidetectd      ipmitool                   fence-agents-all
                        freeipmi                  freeipmi-bmc-watchdog      watchdog        
                        OpenIPMI                  openhpi                                    
Is this ok [y/N]: y
Complete!

20. Install a Package from Specific Repository

To install specific package called nano from the base repo, run the below command.

[root@linuxhelp ~]# dnf --enablerepo=base install nano
Using metadata from Tue Jun 28 16:01:50 2016
Dependencies resolved.
===============================================================================================
 Package            Arch                 Version                      Repository          Size
===============================================================================================
Installing:
 nano               x86_64               2.3.1-10.el7                 base               440 k

Transaction Summary
===============================================================================================
Install  1 Package

Total download size: 440 k
Installed size: 1.6 M
Is this ok [y/N]: y
.
.
.
Installed:
  nano.x86_64 2.3.1-10.el7                                                                     

Complete!

21.Reinstall a Package

The command “ dnf reinstall” will reinstall an already installed package.

[root@linuxhelp ~]# dnf reinstall nano
Using metadata from Tue Jun 28 16:01:50 2016
Dependencies resolved.
===============================================================================================
 Package            Arch                 Version                      Repository          Size
===============================================================================================
Reinstalling:
 nano               x86_64               2.3.1-10.el7                 base               440 k

Transaction Summary
===============================================================================================

Total download size: 440 k
Is this ok [y/N]: y
.
.
Reinstalled:
  nano.x86_64 2.3.1-10.el7                                                                     

Complete!

22. Downgrade a Package

The option “ downgrade” will downgrades the package to its lower version.

[root@linuxhelp ~]# firefox -v
Mozilla Firefox 45.2.0

[root@linuxhelp ~]# dnf downgrade firefox
Using metadata from Tue Jun 28 16:01:50 2016
Dependencies resolved.
===============================================================================================
 Package            Arch              Version                         Repository          Size
===============================================================================================
Downgrading:
 firefox            x86_64            45.1.1-1.el7.centos             updates             76 M

Transaction Summary
===============================================================================================
Downgrade  1 Package

Total download size: 76 M
Is this ok [y/N]: y
.
.
Downgraded:
  firefox.x86_64 45.1.1-1.el7.centos
 
Complete!

23. upgrade a package

The option “ upgrade” will upgrades the mentioned package to higher version.

[root@linuxhelp ~]# dnf upgrade firefox
Using metadata from Tue Jun 28 16:01:50 2016
Dependencies resolved.
===============================================================================================
 Package            Arch              Version                         Repository          Size
===============================================================================================
upgrading:
 firefox            x86_64            45.2.0-1.el7.centos             updates             76 M

Transaction Summary
===============================================================================================
Downgrade  1 Package

Total download size: 76 M
Is this ok [y/N]: y
.
.
Upgraded:
  firefox.x86_64 45.2.0-1.el7.centos
 
Complete!

24. Auto Remove Command

Removes all “ leaf” packages from the system that were originally installed as dependencies of user-installed packages but which are no longer required by any such package.

[root@linuxhelp ~]# dnf autoremove
Using metadata from Tue Jun 28 16:01:50 2016
Dependencies resolved.
===============================================================================================
 Package           Arch              Version                          Repository          Size
===============================================================================================
Removing:
 kernel            x86_64            3.10.0-327.22.2.el7              @System            136 M

Transaction Summary
===============================================================================================
Remove  1 Package

Installed size: 136 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Erasing     : kernel-3.10.0-327.22.2.el7.x86_64                                          1/1
  Verifying   : kernel-3.10.0-327.22.2.el7.x86_64                                          1/1

Removed:
  kernel.x86_64 3.10.0-327.22.2.el7                                                            

Complete!

25. Clean Command

It will cleanup the temporary files kept in some other repositories.

[root@linuxhelp ~]# dnf clean all
Cleaning repos: zabbix-non-supported base updates mariadb zabbix extras
Cleaning up Everything

26. Get Help on Specific DNF Command

To get help of any specific dnf command execute the below command.

[root@linuxhelp ~]# dnf help clean
clean [packages|metadata|dbcache|plugins|expire-cache|all]
Remove cached data

27. List all DNF Commands and Options

Run the following command to list help on all available dnf commands.

[root@linuxhelp ~]# dnf help
usage: dnf [options] COMMAND

List of Main Commands

autoremove                
check-update              Check for available package upgrades
clean                     Remove cached data
distro-sync               Synchronize installed packages to the latest available versions
downgrade                 downgrade a package
group                     Display, or use, the groups information
help                      Display a helpful usage message
history                   Display, or use, the transaction history
info                      Display details about a package or group of packages
install                   Install a package or packages on your system
list                      List a package or groups of packages
makecache                 Generate the metadata cache
provides                  Find what package provides the given value
reinstall                 reinstall a package
remove                    Remove a package or packages from your system
repolist                  Display the configured software repositories
repository-packages       Run commands on top of all packages in given repository
search                    Search package details for the given string
updateinfo                Display advisories about packages
upgrade                   Upgrade a package or packages on your system
upgrade-to                Upgrade a package on your system to the specified version

28. Distro-sync command

The command “ dnf distro-sync” will provide the necessary options to synchronize all installed packages with recent stable versions available. If no package is selected, all installed packages are synchronized.

[root@linuxhelp ~]# dnf distro-sync
Using metadata from Tue Jun 28 16:01:50 2016
Dependencies resolved.
===============================================================================================
 Package           Arch              Version                          Repository          Size
===============================================================================================
Installing:
 kernel            x86_64            3.10.0-327.22.2.el7              updates             33 M

Transaction Summary
===============================================================================================
Install  1 Package

Total downloaded size: 33 M
Installed size: 136 M
Is this ok [y/N]: y
.
.
Installed
kernel.x86_64 3.10.0-327.22.2.el7

Complete!
Tag : CentOS DNF RPM
FAQ
Q
Whether the DNF falls with the same functionality as the yum?
A
Yes. yes almost it falls under same functionality in installing packages.
Q
What is the purpose of using the DNF command in an RPM-based distro?
A
DNF (Dandified Yum) has replaced Yum to become the default software package manager of the Fedora.
Q
How to display the repo list using the DNF command?
A
Execute the command as follows "dnf repolist".
Q
How to search the package using the DNF command?
A
Please run the following command as "dnf search 'package name' "
Q
Whether its possible to check it out the version of DNF?
A
Yes, you can check the version of DNF by "dnf --version"