Chapter 13: Software management

Exercise: Install, inspect and undo

A colleague asks for the zip command. Find the package, check what it needs, install it, see where the files went, and then use the history to take it all back out.

Install, inspect and undo

  • Search, inspect and install a package with dnf.
  • Read the transaction summary and the dependencies.
  • Review and undo a transaction.

Start the exercise

On workstation, start the exercise. It makes sure zip and unzip are not installed on servera.

[student@workstation ~]$ lab start sa-dnf

Later tasks assume that you are logged in to the server they name: ssh student@servera from workstation, then sudo -i for a root shell.

Find the package

On servera as root (sudo -i), confirm that zip is not installed. Search the repositories for it, and show its description.

[student@workstation ~]$ ssh student@servera
[student@servera ~]$ sudo -i
[root@servera ~]# zip
-bash: zip: command not found
[root@servera ~]# dnf search zip | head -6
...output omitted...
zip.x86_64 : A file compression and packaging utility compatible with PKZIP
[root@servera ~]# dnf info zip | head -8
Available Packages
Name         : zip
Version      : 3.0
Release      : 35.el9
Architecture : x86_64
Size         : 263 k
Source       : zip-3.0-35.el9.src.rpm
Repository   : baseos

Check the plan

Run dnf install zip, but answer no at the prompt. Which other package would be installed, and from which repository do both come?

[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

Total download size: 443 k
Installed size: 1.1 M
Is this ok [y/N]: n
Operation aborted.

Both packages come from baseos. Reading before agreeing is the habit to build.

Install it

Install the package for real, with -y, and use it.

[root@servera ~]# dnf install -y zip
...output omitted...
Installed:
  unzip-6.0-60.el9_8.x86_64                zip-3.0-35.el9.x86_64

Complete!
[root@servera ~]# cd /tmp && echo hello > a.txt && zip a.zip a.txt
  adding: a.txt (stored 0%)
[root@servera tmp]# unzip -l a.zip
Archive:  a.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
        6  2026-10-03 17:27   a.txt
---------                     -------
        6                     1 file

Find where things came from

Which package provides /usr/bin/unzip? Use both rpm and dnf. Then list the files of zip that are documentation.

[root@servera tmp]# rpm -qf /usr/bin/unzip
unzip-6.0-60.el9_8.x86_64
[root@servera tmp]# dnf provides /usr/bin/unzip | head -3
unzip-6.0-60.el9_8.x86_64 : A utility for unpacking zip files
Repo        : @System
Matched from:
[root@servera tmp]# rpm -qd zip | head -3
/usr/share/doc/zip/CHANGES
...output omitted...

Read the history

Show the latest transactions, then the details of the install you made.

[root@servera tmp]# dnf history | head -4
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    11 | install -y zip           | 2026-10-03 17:27 | Install        |    2
[root@servera tmp]# dnf history info 11 | tail -6
Packages Altered:
    Install unzip-6.0-60.el9_8.x86_64 @baseos
    Install zip-3.0-35.el9.x86_64     @baseos

Undo it

Undo that transaction, and confirm that both packages are gone.

[root@servera tmp]# dnf history undo last -y
Removed:
  unzip-6.0-60.el9_8.x86_64                zip-3.0-35.el9.x86_64

Complete!
[root@servera tmp]# rpm -q zip unzip
package zip is not installed
package unzip is not installed
[root@servera tmp]# rm -f a.txt a.zip
[root@servera tmp]# exit
[student@servera ~]$ exit

Grade and finish

Check your work with lab grade sa-dnf, then put the exercise away with lab finish sa-dnf.