What Is DNF

This section provides a quick introduction on DNF (also called Dandified YUM), which is the next generation of YUM (Yellowdog Update Modified) software package manager for RPM (RedHat Package Manager) based Linux distributions.

What Is DNF? - DNF, also called Dandified YUM, is the next generation of YUM (Yellowdog Update Modified) software package manager for RPM (RedHat Package Manager) based Linux distributions.

Here is the description of DNF from its manual page: "DNF is the next upcoming major version of YUM, a package manager for RPM-based Linux distributions. It roughly maintains CLI compatibility with YUM and defines a strict API for extensions and plugins."

You can get a list of DNF commands by running "dnf help" on CentOS 8:

herong$ dnf help

usage: dnf [options] COMMAND

List of Main Commands:
alias               List or create command aliases
autoremove          remove all unneeded packages that were originally
                    installed as dependencies
check               check for problems in the packagedb
check-update        check for available package upgrades
clean               remove cached data
deplist             List package's dependencies and what packages provide
                    them
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
mark                mark or unmark installed packages as installed by user.
module              Interact with Modules.
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
repoquery           search for packages matching keyword
repository-packages run commands on top of all packages in given repository
search              search package details for the given string
shell               run an interactive DNF shell
swap                run an interactive dnf mod for remove and install one
                    spec
updateinfo          display advisories about packages
upgrade             upgrade a package or packages on your system
upgrade-minimal     upgrade, but only 'newest' package match which fixes
                    a problem that affects your system

Here are some commonly used DNF commands:

1. Search for package name by keywords.

herong$ dnf search java
  java-11-openjdk.x86_64 : OpenJDK Runtime Environment 11
  java-11-openjdk-src.x86_64 : OpenJDK Source Bundle 11
  java-11-openjdk-demo.x86_64 : OpenJDK Demos 11
  ...

2. Get detailed information of a given package.

herong$ dnf info perl
  Available Packages
  Name         : perl
  Epoch        : 4
  Version      : 5.26.3
  Release      : 416.el8
  Architecture : x86_64
  Size         : 72 k
  Source       : perl-5.26.3-416.el8.src.rpm
  Repository   : AppStream
  Summary      : Practical Extraction and Report Language
  URL          : http://www.perl.org/
  License      : GPL+ or Artistic
  Description  : Perl is a high-level programming language with roots
               : in C, sed, awk and shell scripting.
               ...

3. Install a package.

herong$ sudo dnf install perl
...
Installed:
  perl-4:5.26.3-416.el8.x86_64
  perl-Encode-Locale-1.05-9.el8.noarch
  perl-TermReadKey-2.37-7.el8.x86_64
  ...
Complete!

4. Find which package provides a given program command.

herong$ dnf provides java

java-1.8.0-openjdk-1:1.8.0.312.b07-1.el8_4.x86_64 :
  OpenJDK 8 Runtime Environment
Repo        : AppStream
Matched from:
Provide    : java = 1:1.8.0

5. Display installation history.

herong$ dnf history
 ID | Command line                | Date and time  | Action(s)  | Altered
---------------------------------------------------------------------------
221 | install p7zip               | 2021-06-04     | Install    |    1
220 | install epel-release        | 2021-06-04     | Install    |    1
219 | install php-mysqlnd         | 2021-05-31     | Install    |    2
218 | install php-mbstring        | 2021-05-31     | Install    |    1
217 | install php-json            | 2021-05-31     | Install    |    1
216 | install mysql-server        | 2021-05-31     | Install    |    4 EE
215 | install mysql               | 2021-05-31     | Install    |    3
214 | install php                 | 2021-05-25     | Install    |    5
213 | install httpd               | 2021-05-25     | Install    |    9 EE
212 | install mailx               | 2021-05-21     | Install    |    1
211 | install perl-App-cpanminus  | 2021-05-19     | Install    |  105
210 | install cifs-utils          | 2021-05-18     | Install    |    1
209 | install nmap                | 2021-05-12     | Install    |    1
208 | install telnet              | 2021-05-11     | Install    |    1
207 | remove mysql-server         | 2021-05-11     | Removed    |    7
206 | install mysql-server        | 2021-05-11     | Install    |    7 EE
205 | install dovecot             | 2021-05-11     | Install    |    2 EE
204 | install postfix             | 2021-05-11     | Install    |    1
203 | install tmux                | 2021-05-11     | Install    |    1
202 | update -y                   | 2021-05-11     | I, O, U    |  886 EE

6. View log messages.

herong$ sudo tail -20 /var/log/dnf.log

... WARNING Repository extras is listed more than once in the configuration
... DEBUG Unknown configuration option: protect = 1 in
    /etc/yum.repos.d/zing.repo
... DEBUG Making cache files for all metadata files.
... INFO Metadata cache refreshed recently.
... DDEBUG Cleaning up.
... INFO --- logging initialized ---
... DDEBUG timer: config: 179 ms
... DEBUG Loaded plugins: builddep, changelog, config-manager, copr, ...
... DEBUG DNF version: 4.2.23
... DDEBUG Command: dnf makecache --timer
... DDEBUG Installroot: /
... DDEBUG Releasever: 8
... DEBUG cachedir: /var/cache/dnf
... DDEBUG Base command: makecache
... DDEBUG Extra commands: ['makecache', '--timer']

Table of Contents

 About This Book

 Introduction to Linux Systems

 Cockpit - Web Portal for Administrator

 Process Management

 Memory Management

 Files and Directories

 Users and Groups

 File Systems

 Block Devices and Partitions

 LVM (Logical Volume Manager)

 Installing CentOS

 SELinux - Security-Enhanced Linux

 Network Connection on CentOS

 Internet Networking Tools

 SSH Protocol and ssh/scp Commands

Software Package Manager on CentOS - DNF and YUM

What Is DNF

 Manage DNF Package Repositories

 What Is YUM

 What Is RPM

 What Is pkgs.org

 Install and Manage Java Packages on CentOS

 Install and Manage Perl Packages on CentOS

 Install "git-core" for GitHub Packages on CentOS

 Failed to Download Metadata for Repo ...

 Replacing CentOS Repositories to Local Mirrors

 vsftpd - Very Secure FTP Daemon

 LDAP (Lightweight Directory Access Protocol)

 Administrative Tasks

 References

 Full Version in PDF/EPUB