DNF (Fork of YUM) Command examples

We are working as a LINUX Server/System administrator but most of us don’t know about DNF command and its feature. In this article we are going to explain about DNF and its usage. DNF stands for Dandified yum. We can tell DNF, the next generation of yum package manager (Fork of Yum) using hawkey/libsolv library for backend. Aleš Kozumplík started working on DNF since Fedora 18 and its implemented/launched in Fedora 22 finally.

Now, we are going to play on our Fedora 22 box to explain and cover mostly used DNF commands with examples.
Reference link

DNF Installation in RHEL/CentOS/Scentific linux

By default DNF was enabled in Fedora systems. For RHEL/CentOS/Scentific linux, use the below command to install DNF.

# enable epel repository #
[email protected] [~]# yum install epel-release
or
[email protected] [~]# yum -y install epel-release

# install dnf #
[email protected] [~]# yum install dnf

1) Common syntax/file location for DNF

See below for common syntax/ file location of DNF.

# Common syntax for DNF #
[email protected] [~]# dnf [options] [commands] [package name]

# most popular dnf commands #
[email protected] [~]# [autoremove check-update clean distro-sync downgrade group help history info install list makecache provides reinstall remove repolist repository-packages search updateinfo upgrade upgrade-to]

# dnf config file location #
[email protected] [~]# /etc/dnf/dnf.conf

# dnf cached file location #
[email protected] [~]# /var/cache/dnf

2) Install a Package or packages

Use the below command to install any package or packages on your system. In this case i’m going to install apache, MariaDB-server, MariaDB-client. Every time DNF ask your confirmation to install the corresponding package. if you want to avoid the confirmation you can do by this adding -y option with dnf.

# Install a single package #
[email protected] [~]# dnf install httpd
or
[email protected] [~]# dnf -y install httpd

# Install more than one packages #
[email protected] [~]# dnf install MariaDB-server MariaDB-client
or
[email protected] [~]# dnf -y install MariaDB-server MariaDB-client

Output:
[email protected] [~]# dnf install httpd
Last metadata expiration check performed 0:31:59 ago on Tue Jun  9 22:52:44 2015.
Dependencies resolved.
================================================================================
 Package        Arch            Version                   Repository       Size
================================================================================
Installing:
 httpd          x86_64          2.4.12-1.fc22             fedora          1.2 M

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

Total download size: 1.2 M
Installed size: 3.8 M
Is this ok [y/N]: y
Downloading Packages:
httpd-2.4.12-1.fc22.x86_64.rpm                   46 kB/s | 1.2 MB     00:27    
--------------------------------------------------------------------------------
Total                                            35 kB/s | 1.2 MB     00:35     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Installing  : httpd-2.4.12-1.fc22.x86_64                                  1/1 
  Verifying   : httpd-2.4.12-1.fc22.x86_64                                  1/1 

Installed:
  httpd.x86_64 2.4.12-1.fc22                                                    

Complete!

3) Remove a Package or packages

Use the below command to remove/erase any package or packages on your system. In this case I’m going to remove apache, MariaDB-server, MariaDB-client.

# Remove a single package #
[email protected] [~]# dnf remove httpd
or
[email protected] [~]# dnf erase httpd

# Remove more than one packages #
[email protected] [~]# dnf remove MariaDB-server MariaDB-client
or
[email protected] [~]# dnf erase MariaDB-server MariaDB-client

Output:
[email protected] [~]# dnf install httpd
Dependencies resolved.
================================================================================
 Package                Arch         Version                Repository     Size
================================================================================
Removing:
 gnome-user-share       x86_64       3.14.2-1.fc22          @System       467 k
 httpd                  x86_64       2.4.12-1.fc22          @System       3.8 M
 mod_dnssd              x86_64       0.6-12.fc22            @System        53 k
 php                    x86_64       5.6.9-1.fc22           @System       8.6 M

Transaction Summary
================================================================================
Remove  4 Packages

Installed size: 13 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Erasing     : gnome-user-share-3.14.2-1.fc22.x86_64                       1/4 
  Erasing     : mod_dnssd-0.6-12.fc22.x86_64                                2/4 
  Erasing     : php-5.6.9-1.fc22.x86_64                                     3/4 
  Erasing     : httpd-2.4.12-1.fc22.x86_64                                  4/4 
  Verifying   : httpd-2.4.12-1.fc22.x86_64                                  1/4 
  Verifying   : php-5.6.9-1.fc22.x86_64                                     2/4 
  Verifying   : mod_dnssd-0.6-12.fc22.x86_64                                3/4 
  Verifying   : gnome-user-share-3.14.2-1.fc22.x86_64                       4/4 

Removed:
  gnome-user-share.x86_64 3.14.2-1.fc22        httpd.x86_64 2.4.12-1.fc22       
  mod_dnssd.x86_64 0.6-12.fc22                 php.x86_64 5.6.9-1.fc22          

Complete!

4) update a Package or packages

Use the below command to update any package or packages on your system. In this case I’m going to update openssh, MariaDB-server, MariaDB-client to latest version.

# update single package #
[email protected] [~]# dnf update httpd

# update more than one packages #
[email protected] [~]# dnf update MariaDB-server MariaDB-client

Output:
[email protected] [~]# dnf update openssh
Last metadata expiration check performed 0:18:34 ago on Sat Jun 13 11:48:58 2015.
Dependencies resolved.
================================================================================
 Package                Arch          Version              Repository      Size
================================================================================
Upgrading:
 openssh                x86_64        6.8p1-8.fc22         updates        466 k
 openssh-askpass        x86_64        6.8p1-8.fc22         updates         76 k
 openssh-clients        x86_64        6.8p1-8.fc22         updates        665 k
 openssh-server         x86_64        6.8p1-8.fc22         updates        463 k

Transaction Summary
================================================================================
Upgrade  4 Packages

Total download size: 1.6 M
Is this ok [y/N]:y

5) list all repository packages

Use the below command to list all packages which are available in all repository. I have enabled EPEL, so in this case it shows all the repository packages. Both gives same results.

# list all repository packages #
[email protected] [~]# dnf list
or
[email protected] [~]# dnf list all
or
[email protected] [~]# dnf list available

Output:
[email protected] [~]# dnf list all | more
Last metadata expiration check performed 0:37:47 ago on Tue Jun  9 22:52:44 2015
.
Installed Packages
GConf2.x86_64                            3.2.6-11.fc22                   @System
LibRaw.x86_64                            0.16.2-1.fc22                   @System
ModemManager.x86_64                      1.4.6-1.fc22                    @System
ModemManager-glib.x86_64                 1.4.6-1.fc22                    @System
NetworkManager.x86_64                    1:1.0.2-1.fc22                  @System
NetworkManager-adsl.x86_64               1:1.0.2-1.fc22                  @System
NetworkManager-bluetooth.x86_64          1:1.0.2-1.fc22                  @System
NetworkManager-config-connectivity-fedora.x86_64
                                         1:1.0.2-1.fc22                  @System
NetworkManager-glib.x86_64               1:1.0.2-1.fc22                  @System
NetworkManager-libnm.x86_64              1:1.0.2-1.fc22                  @System
NetworkManager-openconnect.x86_64        1.0.2-1.fc22                    @System
NetworkManager-openvpn.x86_64            1:1.0.2-2.fc22                  @System
NetworkManager-openvpn-gnome.x86_64      1:1.0.2-2.fc22                  @System
NetworkManager-pptp.x86_64               1:1.1.0-1.20150428git695d4f2.fc22
                                                                         @System
NetworkManager-pptp-gnome.x86_64         1:1.1.0-1.20150428git695d4f2.fc22
                                                                         @System
NetworkManager-team.x86_64               1:1.0.2-1.fc22                  @System
NetworkManager-vpnc.x86_64               1:1.0.2-1.fc22                  @System
--More--

6) Check updates

Use the below command to check available package updates on your system. In this case kernel update is available. Both gives same results.

# Checking avaliable package updates #
[email protected] [~]# dnf list updates
or
[email protected] [~]# dnf check-update
Fedora 22 - x86_64 - Updates                     46 kB/s | 7.3 MB     02:44    
Last metadata expiration check performed 0:01:38 ago on Sat Jun 13 11:48:58 2015.

autocorr-en.noarch                             1:4.4.3.2-6.fc22          updates
createrepo_c.x86_64                            0.9.0-1.fc22              updates
createrepo_c-libs.x86_64                       0.9.0-1.fc22              updates
evolution.x86_64                               3.16.3-2.fc22             updates
evolution-data-server.x86_64                   3.16.3-1.fc22             updates
evolution-ews.x86_64                           3.16.3-1.fc22             updates
evolution-help.noarch                          3.16.3-2.fc22             updates
firefox.x86_64                                 38.0.5-2.fc22             updates
git.x86_64                                     2.4.3-1.fc22              updates
gnome-disk-utility.x86_64                      3.16.2-2.fc22             updates
gnome-software.x86_64                          3.16.3-1.fc22             updates
highlight.x86_64                               3.22-1.fc22               updates
libcacard.x86_64                               2:2.3.0-5.fc22            updates
libmwaw.x86_64                                 0.3.5-1.fc22              updates
libpurple.x86_64                               2.10.11-12.fc22           updates
libreoffice-calc.x86_64                        1:4.4.3.2-6.fc22          updates
libreoffice-core.x86_64                        1:4.4.3.2-6.fc22          updates
libreoffice-draw.x86_64                        1:4.4.3.2-6.fc22          updates
.
.
stunnel.x86_64                                 5.16-1.fc22               updates
unbound-libs.x86_64                            1.5.3-4.fc22              updates

7) list installed packages

Use the below command to print installed packages on your Linux system.

# Checking avaliable package updates #
[email protected] [~]# dnf list installed
Last metadata expiration check performed 0:41:20 ago on Tue Jun  9 22:52:44 2015.
Installed Packages
GConf2.x86_64                          3.2.6-11.fc22                     @System
LibRaw.x86_64                          0.16.2-1.fc22                     @System
ModemManager.x86_64                    1.4.6-1.fc22                      @System
ModemManager-glib.x86_64               1.4.6-1.fc22                      @System
NetworkManager.x86_64                  1:1.0.2-1.fc22                    @System
NetworkManager-adsl.x86_64             1:1.0.2-1.fc22                    @System
NetworkManager-bluetooth.x86_64        1:1.0.2-1.fc22                    @System
NetworkManager-config-connectivity-fedora.x86_64
                                       1:1.0.2-1.fc22                    @System
NetworkManager-glib.x86_64             1:1.0.2-1.fc22                    @System
NetworkManager-libnm.x86_64            1:1.0.2-1.fc22                    @System
NetworkManager-openconnect.x86_64      1.0.2-1.fc22                      @System
NetworkManager-openvpn.x86_64          1:1.0.2-2.fc22                    @System
NetworkManager-openvpn-gnome.x86_64    1:1.0.2-2.fc22                    @System
NetworkManager-pptp.x86_64             1:1.1.0-1.20150428git695d4f2.fc22 @System
NetworkManager-pptp-gnome.x86_64       1:1.1.0-1.20150428git695d4f2.fc22 @System
NetworkManager-team.x86_64             1:1.0.2-1.fc22                    @System
NetworkManager-vpnc.x86_64             1:1.0.2-1.fc22                    @System
--More--

8) Search a package

If you don’t know the exact package name which you want to install, Use the search option it will return the matching string. In this case I’m going to search ftpd.

# Search a package #
[email protected] [~]# dnf search ftpd
Last metadata expiration check performed 0:42:28 ago on Tue Jun  9 22:52:44 2015.
============================== N/S Matched: ftpd ===============================
proftpd-utils.x86_64 : ProFTPD - Additional utilities
pure-ftpd-selinux.x86_64 : SELinux support for Pure-FTPD
proftpd-devel.i686 : ProFTPD - Tools and header files for developers
proftpd-devel.x86_64 : ProFTPD - Tools and header files for developers
proftpd-ldap.x86_64 : Module to add LDAP support to the ProFTPD FTP server
proftpd-mysql.x86_64 : Module to add MySQL support to the ProFTPD FTP server
proftpd-postgresql.x86_64 : Module to add PostgreSQL support to the ProFTPD FTP
                          : server
vsftpd.x86_64 : Very Secure Ftp Daemon
proftpd.x86_64 : Flexible, stable and highly-configurable FTP server
owfs-ftpd.x86_64 : FTP daemon providing access to 1-Wire networks
perl-ftpd.noarch : Secure, extensible and configurable Perl FTP server
pure-ftpd.x86_64 : Lightweight, fast and secure FTP server
pyftpdlib.noarch : Python FTP server library
nordugrid-arc-gridftpd.x86_64 : ARC gridftp server

The above output shows matching string for ftpd.

9) Check package information

If you want to know the package detailed information before proceeding with the installation. Use the below command, it will give full information about the package like package version, size, repo name, etc..

# Search a package #
[email protected] [~]# dnf info httpd
Last metadata expiration check performed 0:43:39 ago on Tue Jun  9 22:52:44 2015.
Installed Packages
Name        : httpd
Arch        : x86_64
Epoch       : 0
Version     : 2.4.12
Release     : 1.fc22
Size        : 3.8 M
Repo        : @System
From repo   : fedora
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

Available Packages
Name        : httpd
Arch        : i686
Epoch       : 0
Version     : 2.4.12
Release     : 1.fc22
Size        : 1.2 M
Repo        : fedora
Summary     : Apache HTTP Server
URL         : http://httpd.apache.org/
License     : ASL 2.0
Description : The Apache HTTP Server is a powerful, efficient, and extensible
            : web server.

10) How to Check package is installed or not

Use the below command to check whether the package is installed or not on your system. In this case I’m going to check openssh package.

# check whether the package installed on system #
[email protected] [~]# dnf list installed httpd
Last metadata expiration check performed 0:44:26 ago on Tue Jun  9 22:52:44 2015.
Installed Packages
httpd.x86_64                        2.4.12-1.fc22                        @System

11) dnf provides / whatprovides function

This command searches which packages provide the requested dependency of file.

# provides / whatprovides function #
[email protected] [~]# dnf provides /etc/passwd
Last metadata expiration check performed 0:47:38 ago on Tue Jun  9 22:52:44 2015.
setup-2.9.6-1.fc22.noarch : A set of system configuration and setup files
Repo        : @System

setup-2.9.6-1.fc22.noarch : A set of system configuration and setup files
Repo        : fedora

12) Purpose of makecache

Makecache is used to download and make usable all the metadata for the currently enabled repository on your system.

# Purpose of makecache #
[email protected] [~]# dnf makecache
Metadata cache created.

13) Print dnf repositories

Use the below command to print the list of repositories available on your system.

# To print enabled repository #
[email protected] [~]# dnf repolist
Last metadata expiration check performed 0:50:02 ago on Tue Jun  9 22:52:44 2015.
repo id                    repo name                                      status
*fedora                    Fedora 22 - x86_64                             44,762
*updates                   Fedora 22 - x86_64 - Updates                    3,677

# To print Disabled repository #
[email protected] [~]# dnf repositories disabled
Last metadata expiration check performed 0:52:19 ago on Tue Jun  9 22:52:44 2015.
repo id                          repo name                                      
fedora-debuginfo                                                                
fedora-source                                                                   
updates-debuginfo                                                               
updates-source                                                                  
updates-testing                                                                 
updates-testing-debuginfo                                                       
updates-testing-source

# To print all repository #
[email protected] [~]# dnf repolist all
Last metadata expiration check performed 0:53:17 ago on Tue Jun  9 22:52:44 2015.
repo id                   repo name                              status
*fedora                   Fedora 22 - x86_64                     enabled: 44,762
fedora-debuginfo          Fedora 22 - x86_64 - Debug             disabled
fedora-source             Fedora 22 - Source                     disabled
*updates                  Fedora 22 - x86_64 - Updates           enabled:  3,677
updates-debuginfo         Fedora 22 - x86_64 - Updates - Debug   disabled
updates-source            Fedora 22 - Updates Source             disabled
updates-testing           Fedora 22 - x86_64 - Test Updates      disabled
updates-testing-debuginfo Fedora 22 - x86_64 - Test Updates Debu disabled
updates-testing-source    Fedora 22 - Test Updates Source        disabled

14) Do full system update

Use the below command to keep your system up to date. It will install all the available updates.

# update all system packages #
[email protected] [~]# dnf update
or
# update all system packages #
[email protected] [~]# dnf upgrade
Last metadata expiration check performed 1:09:27 ago on Sat Jun 13 11:48:58 2015.
Dependencies resolved.
================================================================================
 Package                           Arch     Version             Repository
                                                                           Size
================================================================================
Installing:
 git-core                          x86_64   2.4.3-1.fc22        updates   5.0 M
Upgrading:
 autocorr-en                       noarch   1:4.4.3.2-6.fc22    updates   174 k
 createrepo_c                      x86_64   0.9.0-1.fc22        updates    72 k
 createrepo_c-libs                 x86_64   0.9.0-1.fc22        updates    89 k
 evolution                         x86_64   3.16.3-2.fc22       updates   8.5 M
 evolution-data-server             x86_64   3.16.3-1.fc22       updates   3.0 M
 evolution-ews                     x86_64   3.16.3-1.fc22       updates   490 k
 evolution-help                    noarch   3.16.3-2.fc22       updates   2.1 M
 firefox                           x86_64   38.0.5-2.fc22       updates    69 M
 git                               x86_64   2.4.3-1.fc22        updates   4.5 M
 gnome-disk-utility                x86_64   3.16.2-2.fc22       updates   984 k
 gnome-software                    x86_64   3.16.3-1.fc22       updates   2.0 M
 highlight                         x86_64   3.22-1.fc22         updates   669 k
 libcacard                         x86_64   2:2.3.0-5.fc22      updates    73 k
 libmwaw                           x86_64   0.3.5-1.fc22        updates   2.3 M
Transaction Summary
================================================================================
Install   1 Package
Upgrade  68 Packages

Total download size: 258 M
Is this ok [y/N]: y

15) Purpose of autoremove

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.

# Purpose of makecache #
[email protected] [~]# dnf autoremove
Last metadata expiration check performed 0:55:06 ago on Tue Jun  9 22:52:44 2015.
Dependencies resolved.
Nothing to do.
Complete!

16) dnf version checking

Use the below command to check the DNF version installed on your system.

# dnf version checking #
[email protected] [~]# dnf --version
1.0.0
  Installed: dnf-0:1.0.0-1.fc22.noarch at 2015-06-03 17:40
  Built    : Fedora Project at 2015-05-02 13:00

  Installed: rpm-0:4.12.0.1-9.fc22.x86_64 at 2015-06-03 17:38
  Built    : Fedora Project at 2015-04-15 09:21

17) Distro-sync command

Synchronize installed packages to the latest stable/available versions from any enabled repository. If no package is given, all installed packages are considered.

# Distro-sync command #
[email protected] [~]# dnf distro-sync
Last metadata expiration check performed 0:07:57 ago on Sat Jun 13 11:48:58 2015.
Dependencies resolved.
================================================================================
 Package                           Arch     Version             Repository
                                                                           Size
================================================================================
Installing:
 git-core                          x86_64   2.4.3-1.fc22        updates   5.0 M
Upgrading:
 autocorr-en                       noarch   1:4.4.3.2-6.fc22    updates   174 k
 createrepo_c                      x86_64   0.9.0-1.fc22        updates    72 k
 createrepo_c-libs                 x86_64   0.9.0-1.fc22        updates    89 k
 evolution                         x86_64   3.16.3-2.fc22       updates   8.5 M
 evolution-data-server             x86_64   3.16.3-1.fc22       updates   3.0 M
 evolution-ews                     x86_64   3.16.3-1.fc22       updates   490 k
 evolution-help                    noarch   3.16.3-2.fc22       updates   2.1 M
 firefox                           x86_64   38.0.5-2.fc22       updates    69 M
 git                               x86_64   2.4.3-1.fc22        updates   4.5 M
 gnome-disk-utility                x86_64   3.16.2-2.fc22       updates   984 k
 gnome-software                    x86_64   3.16.3-1.fc22       updates   2.0 M
 highlight                         x86_64   3.22-1.fc22         updates   669 k
 libcacard                         x86_64   2:2.3.0-5.fc22      updates    73 k
 libmwaw                           x86_64   0.3.5-1.fc22        updates   2.3 M
 libpurple                         x86_64   2.10.11-12.fc22     updates   5.8 M

Transaction Summary
================================================================================
Install   1 Package
Upgrade  68 Packages

Total download size: 258 M
Is this ok [y/N]: y

18) Downgrade a Package

Downgrade command used to rollback/downgrade a package to previous version.

# Downgrade a Package #
[email protected] [~]# dnf downgrade firefox
Last metadata expiration check performed 0:25:11 ago on Sat Jun 13 11:48:58 2015.
Dependencies resolved.
================================================================================
 Package          Arch            Version                 Repository       Size
================================================================================
Downgrading:
 firefox          x86_64          38.0.1-1.fc22           fedora           68 M

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

Total download size: 68 M
Is this ok [y/N]: y

19) Reinstall a Package

Used to reinstall already installed package, its not necessary as my point of view.

# Reinstall a Package #
[email protected] [~]# dnf reinstall httpd
Last metadata expiration check performed 1:06:15 ago on Tue Jun  9 22:52:44 2015.
Dependencies resolved.
================================================================================
 Package        Arch            Version                   Repository       Size
================================================================================
Reinstalling:
 httpd          x86_64          2.4.12-1.fc22             fedora          1.2 M

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

Total download size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
httpd-2.4.12-1.fc22.x86_64.rpm                   10 kB/s | 1.2 MB     02:03    
--------------------------------------------------------------------------------
Total                                           9.4 kB/s | 1.2 MB     02:14     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Reinstalling: httpd-2.4.12-1.fc22.x86_64                                  1/2 
  Erasing     : httpd-2.4.12-1.fc22.x86_64                                  2/2 
  Verifying   : httpd-2.4.12-1.fc22.x86_64                                  1/2 
  Verifying   : httpd-2.4.12-1.fc22.x86_64                                  2/2 

Reinstalled:
  httpd.x86_64 2.4.12-1.fc22                                                    

Complete!

20) Upgrade-to Command

The upgrade-to command updates the packages to the specified version.

# Upgrade-to Command #
[email protected] [~]# dnf upgrade-to openssh 6.8p1-8.fc22
Last metadata expiration check performed 0:23:17 ago on Sat Jun 13 11:48:58 2015.
Dependencies resolved.
================================================================================
 Package                Arch          Version              Repository      Size
================================================================================
Upgrading:
 openssh                x86_64        6.8p1-8.fc22         updates        466 k
 openssh-askpass        x86_64        6.8p1-8.fc22         updates         76 k
 openssh-clients        x86_64        6.8p1-8.fc22         updates        665 k
 openssh-server         x86_64        6.8p1-8.fc22         updates        463 k

Transaction Summary
================================================================================
Upgrade  4 Packages

Total download size: 1.6 M
Is this ok [y/N]: y

21) list available group packages

Use the below command to list available group of packages on your system. In these groups no of packages are bundled together with a single name. So you can install the group of packages with single shot instead of installing each and every software separately.

# group package list #
[email protected] [~]# dnf grouplist
Last metadata expiration check performed 0:31:39 ago on Sat Jun 13 11:48:58 2015.
Available environment groups:
   Minimal Install
   Fedora Server
   Fedora Workstation
   Fedora Cloud Server
   KDE Plasma Workspaces
   Xfce Desktop
   LXDE Desktop
   LXQt Desktop
   Cinnamon Desktop
   MATE Desktop
   Sugar Desktop Environment
   Development and Creative Workstation
   Web Server
   Infrastructure Server
   Basic Desktop
Available groups:
   3D Printing
   Administration Tools
   Audio Production
   Authoring and Publishing
   Books and Guides
   C Development Tools and Libraries
   Cloud Infrastructure
   Cloud Management Tools
   Container Management
   D Development Tools and Libraries
   Design Suite
   Development Tools
   Domain Membership
   Fedora Eclipse
   Editors
   Educational Software
   Electronic Lab
   Engineering and Scientific
   FreeIPA Server
   Games and Entertainment
   Headless Management
   LibreOffice
   MATE Applications
   MATE Compiz
   Medical Applications
   Milkymist
   Network Servers
   Office/Productivity
   Robotics
   RPM Development Tools
   Security Lab
   Sound and Video
   System Tools
   Text-based Internet
   Window Managers

22) Install the group of packages

To install group of packages use groupinstall instead of install with yum command. In this case i’m going to install “Editors”. Its bundled with lots package which was related with editors and supporting packages.

# Install the group of packages #
[email protected] [~]# dnf groupinstall 'Editors''
Last metadata expiration check performed 0:43:39 ago on Sat Jun 13 11:48:58 2015.
Dependencies resolved.
================================================================================
 Group         Packages                                                       
================================================================================
Marking installed:
 Editors       xemacs-packages-extra      nedit                     zile      
               xmlcopyeditor              emacs-bbdb                geany     
               emacs-ess                  emacs                     jed       
               psgml                      code-editor               emacs-vm  
               emacs-muse                 gobby                     leafpad   
               joe                        cssed                     vim-X11   
               vim-enhanced               xemacs-xft                xemacs-ess
               xemacs                     xemacs-packages-base      poedit    
               emacs-auctex               xemacs-muse                         
Is this ok [y/N]: y
Complete!

23) update the group packages

Use the below command to update the group of packages to latest version.

# update the group packages #
[email protected] [~]# dnf groupupdate 'Editors'
Last metadata expiration check performed 0:08:36 ago on Mon Jun 15 12:15:59 2015.
Group 'Editors' is already installed, skipping.
Dependencies resolved.
Is this ok [y/N]: y
Complete!

24) Remove the group packages

Use the below command to update the group of packages to latest version.

# Remove the group packages #
[email protected] [~]# dnf groupremove 'Editors'
or
# Remove the group packages #
[email protected] [~]# dnf grouperase 'Development tools'
Warning: Group 'Editors' does not exist.
Dependencies resolved.
Is this ok [y/N]: y
Complete!

25) Install a package from particular Repository

Use the below command to Install a package from particular Repository. In this case I’m going to install Htop package from rpmforge repository.

# Install a package from particular Repository #
[email protected] [~]# dnf --enablerepo=epel install htop

26) Cleaning dnf cache

Whenever you are installing packages dnf creates a cache of metadata and packages. This cache can take up a lot space. The dnf clean command allows you to clean up these files. All the files dnf clean will act on are normally stored in /var/cache/dnf.

# cleans up any cached db packages #
[email protected] [~]# dnf clean dbcache

# cleans up any cached expire-cache packages #
[email protected] [~]# dnf clean expire-cache

# cleans up any cached xml metadata #
[email protected] [~]# dnf clean metadata

# cleans up any cached packages #
[email protected] [~]# dnf clean packages

# cleans up any cached plugins #
[email protected] [~]# dnf clean plugins

# Clean all cached files #
[email protected] [~]# dnf clean all

27) List Command

The list command can help us to print the output basedon our criteria.

# Lists all packages #
[email protected] [~]# dnf list all
or
[email protected] [~]# dnf list

# Lists installed packages #
[email protected] [~]# dnf list installed

# Lists available packages #
[email protected] [~]# dnf list available

# Lists extras, that is packages installed on the system that are not available in any known repository #
[email protected] [~]# dnf list extras

# List the packages installed on the system that are obsoleted by packages in any known repository #
[email protected] [~]# dnf list obsoletes

# List packages recently added into the repositories #
[email protected] [~]# dnf list recent

# List upgrades available for the installed packages #
[email protected] [~]# dnf list upgrades

# List packages which will be removed by dnf autoremove command #
[email protected] [~]# dnf list autoremove

28) Print dnf history

Use the below command to Print dnf history.

# Print dnf history #
[email protected] [~]# dnf history
Last metadata expiration check performed 0:30:01 ago on Mon Jun 15 12:15:59 2015.
ID     | Command line             | Date a | Action | Altere
-------------------------------------------------------------------------------
     6 | install dnf-automatic    | 2015-06-13 13:05 | Install        |    1  <
     5 | reinstall httpd          | 2015-06-10 00:01 | Reinstall      |    1 > 
     4 | install vsftpd           | 2015-06-09 23:39 | Install        |    1   
     3 | install httpd            | 2015-06-09 23:25 | Install        |    1   
     2 | remove httpd             | 2015-06-09 23:22 | Erase          |    4   
     1 | update                   | 2015-06-09 23:14 | I, U           |   81

29) Enable DNF Automatic

If you want to automate the updates on your system, you can do by installation dnf-automatic package. After installaing a pacakge, make sure you need to edit the /etc/dnf/automatic.con file and change apply_updates = yes insteadof apply_updates = no.

# Install DNF Automatic package #
[email protected] [~]# dnf install dnf-automatic

# Enable DNF Automatic #
[email protected] [~]# systemctl enable dnf-automatic.timer
Created symlink from /etc/systemd/system/basic.target.wants/dnf-automatic.timer to /usr/lib/systemd/system/dnf-automatic.timer.

# Start DNF Automatic service #
[email protected] [~]# systemctl start dnf-automatic.timer

30) dnf man page

Use the below command for More info about dnf command.

# dnf man page #
[email protected] [~]# dnf -help
or
[email protected] [~]# dnf --h
or
[email protected] [~]# man dnf

That’s all over as of now about DNF. I think everybody learned DNF stuffs.

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...

Close
Please support the site
By clicking any of these buttons you help our site to get better