Chapter 13: Software management

Installing and updating software with dnf

dnf is the everyday tool for software on RHEL. It knows the repositories you have configured, finds packages, works out and installs every dependency, verifies signatures, and keeps a history of everything it did so that you can review or undo it. This lesson covers the commands you will use daily.

What happens when you install

What dnf does for you: Step through dnf install zip.

Finding software

CommandAnswers
dnf search WORDWhich packages mention the word in their name or summary?
dnf info NAMEDetails: version, size, repository, description
dnf provides /path/to/file or dnf provides "*/semanage"Which package supplies this file (even if not installed)?
dnf list installed, dnf list available, dnf list --upgradesThe three lists
dnf repoquery --requires NAMEWhat does a package depend on?

dnf provides is the answer to "command not found": find which package ships the program, then install it.

Installing and removing

[root@servera ~]# dnf install zip
Dependencies resolved.
================================================================================
 Package         Architecture      Version               Repository          Size
================================================================================
Installing:
 zip             x86_64            3.0-35.el9            baseos             263 k
Installing dependencies:
 unzip           x86_64            6.0-60.el9_8          baseos             180 k

Transaction Summary
================================================================================
Install  2 Packages

Is this ok [y/N]: y
...output omitted...
Complete!

Read the summary before answering. It tells you what will be installed, upgraded or removed. -y answers yes automatically, which is fine for something you have already checked and dangerous otherwise.

CommandDoes
dnf install NAME [NAME...]Install packages and their dependencies
dnf remove NAMERemove the package, and dependencies nothing else needs
dnf reinstall NAMEPut a damaged package back
dnf upgrade [NAME]Apply updates to everything (or to one package); dnf update is the same
dnf install ./file.rpmInstall a local file and resolve its dependencies from the repositories
dnf group list, dnf group install "NAME"Named sets of packages

Updates

[root@servera ~]# dnf check-update | head -3
kernel.x86_64                          5.14.0-687.54.1.el9_8              baseos
kernel-core.x86_64                     5.14.0-687.54.1.el9_8              baseos
kernel-modules.x86_64                  5.14.0-687.54.1.el9_8              baseos

check-update lists what is available without installing it. A kernel update installs a new kernel next to the old ones (several are kept); it takes effect after a reboot. The next lessons cover security updates and the reboot decision.

History: the undo button

Every dnf transaction is recorded:

[root@servera ~]# dnf history | head -4
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    11 | install -y zip           | 2026-10-03 17:27 | Install        |    2
    10 | module remove -y nginx   | 2026-10-03 17:27 | Removed        |   88 EE
[root@servera ~]# dnf history info 11 | tail -6
[root@servera ~]# dnf history undo last
Removed:
  unzip-6.0-60.el9_8.x86_64                zip-3.0-35.el9.x86_64

Complete!

dnf history info ID lists the packages a transaction changed, and dnf history undo ID reverses it. This is the safest way back from "I installed something and now things are different".

Try it

Check your understanding