4.4 YUM, DNF & Zypper Package Management (102.5)
Key Takeaways
- YUM and DNF provide high-level, dependency-resolving package management for RPM distributions, with DNF offering superior performance and SAT-based dependency solving via libsolv.
- The provides (or whatprovides) subcommand locates which package supplies a specific command, library, or file path.
- DNF/YUM transaction history (history list, info, undo, rollback) allows auditing and reversing complete package transactions.
- System configuration is defined in /etc/dnf/dnf.conf (or /etc/yum.conf), while repository files reside in /etc/yum.repos.d/*.repo.
- openSUSE's zypper provides high-speed package management with short command aliases (in, rm, up, dup, se, wp, ref, lr) powered by the ZYpp engine.
4.4 YUM, DNF & Zypper Package Management (102.5)
Quick Summary: While low-level
rpmmanages individual archive files locally, modern enterprise RPM distributions rely on high-level package management frameworks to automatically resolve dependencies, query remote software mirrors, download packages, and apply transaction updates. YUM (Yellowdog Updater, Modified) and its modern successor DNF (Dandified YUM) serve Red Hat Enterprise Linux, CentOS, Rocky Linux, and Fedora. In the SUSE Linux ecosystem, Zypper provides high-speed package management utilizing thelibsolvSAT solver engine.
1. Evolution of High-Level RPM Management: YUM vs. DNF Architecture
Historically, YUM managed RPM packages across RHEL/CentOS 5, 6, and 7. However, as software repositories scaled, YUM suffered from high memory consumption, slow dependency calculation, and an undocumented Python API. DNF replaced YUM in Fedora and RHEL 8/9, introducing major architectural improvements:
- SAT-Based Dependency Resolver (
libsolv): DNF employs the state-of-the-art Boolean Satisfiability (SAT) algorithm developed by SUSE for instant, deterministic dependency resolution. - Performance & Memory Efficiency: Core metadata parsing is implemented in optimized C/C++ libraries (
libdnf,librepo). - Backward Compatibility: DNF preserves virtually identical command syntax to YUM. On modern RHEL/Fedora systems,
/usr/bin/yumis a symbolic link pointing directly to/usr/bin/dnf.
┌─────────────────────────────────────────────────────────────┐
│ DNF / YUM Front-End │
├─────────────────────────────────────────────────────────────┤
│ libsolv (SAT Solver) │ librepo (HTTP/FTP Metadata) │
├────────────────────────┴────────────────────────────────────┤
│ RPM Engine (/var/lib/rpm/) │
└─────────────────────────────────────────────────────────────┘
2. YUM / DNF Command Operations
Both yum and dnf share a unified set of subcommands for package operations.
| Command Syntax | Operational Purpose & Behavior |
|---|---|
dnf install <pkg>... | Downloads and installs package(s) along with all prerequisite dependencies. |
dnf update / dnf upgrade | Upgrades all installed packages to their newest available versions. (In DNF, update is an alias for upgrade). |
dnf check-update | Queries enabled repositories and lists available package updates without installing them. Returns exit code 100 if updates are available. |
dnf remove <pkg> / erase | Removes specified package(s) and automatically removes unneeded dependent packages. |
dnf reinstall <pkg> | Downloads and reinstalls the exact version of an already installed package. |
dnf search <keyword> | Searches package names and summaries for matching text strings. |
dnf info <pkg> | Displays detailed package metadata, description, license, size, and repository source. |
dnf list installed | Lists all packages currently installed on the host. |
dnf list available | Lists all packages available in enabled repositories that are not currently installed. |
dnf list updates | Lists all installed packages for which newer versions exist in repositories. |
dnf provides <file_or_feature><br/>dnf whatprovides <file> | Searches repositories to identify which package supplies a specific binary path, library, or virtual capability. |
dnf clean all | Flushes all cached repository metadata, XML databases, and downloaded RPM packages from /var/cache/dnf/. |
dnf makecache | Downloads repository metadata and builds a local SQLite cache for fast subsequent queries. |
# Find which package provides the 'netstat' or 'ifconfig' command
$ dnf provides "*/netstat"
net-tools-2.0-0.62.20160912git.el9.x86_64 : Basic networking tools
Repo : @System
Matched from:
Filename : /usr/bin/netstat
# Check for available security and software updates
$ dnf check-update
💡 LPIC-1 Exam Fill-in-the-Blank Alert: The command to find which package owns or provides a specific file or command across all repositories (even uninstalled packages) is
dnf provides <path>oryum provides <path>(orwhatprovides).
3. Transaction History & Rollback Operations
DNF and YUM record every package transaction in a persistent SQLite history database. This allows administrators to audit historical package installations, view who performed an action, and roll back broken updates.
# View chronological list of recent package management transactions
$ sudo dnf history
ID | Command line | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
4 | install nginx | 2026-08-28 14:10 | Install | 4
3 | upgrade -y | 2026-08-25 09:30 | Upgrade | 28 EE
2 | install gcc make | 2026-08-20 11:15 | Install | 12
1 | Initial installation | 2026-08-01 08:00 | Install | 485
# Display granular details of transaction ID 4
$ sudo dnf history info 4
# Undo ONLY the specific actions taken in transaction ID 4
$ sudo dnf history undo 4
# Roll back ALL transactions that occurred after transaction ID 2
$ sudo dnf history rollback 2
⚠️ LPIC-1 Trap: Note the fundamental distinction between
undoandrollback:
dnf history undo <id>: Reverses only the single transaction specified by<id>.dnf history rollback <id>: Reverses all transactions that occurred after<id>, reverting the operating system back to its exact state at the conclusion of transaction<id>.
4. Package Groups Management
DNF/YUM packages related software suites into Package Groups (e.g., "Development Tools", "Web Server", "Virtualization Host"), enabling single-command provisioning of entire software environments.
# List all installed and available package groups
$ dnf grouplist
Available Environment Groups:
Server with GUI
Development and Creative Workstation
Available Groups:
Development Tools
RPM Development Tools
Security Tools
# Display mandatory, default, and optional packages in a group
$ dnf groupinfo "Development Tools"
# Install all mandatory and default packages in the group
$ sudo dnf groupinstall "Development Tools"
# OR using modern DNF syntax:
$ sudo dnf group install "Development Tools"
# Remove all packages associated with the group
$ sudo dnf groupremove "Development Tools"
5. Configuration Directives in dnf.conf and yum.conf
The master configuration file is located at /etc/dnf/dnf.conf (or /etc/yum.conf). It contains a mandatory [main] section that governs global package manager behavior.
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True
skip_if_unavailable=False
cachedir=/var/cache/dnf
keepcache=0
exactarch=1
obsoletes=1
Key Configuration Directives
gpgcheck=1: Enforces GPG signature checking on all downloaded packages.installonly_limit=3: Limits the number of simultaneous kernel versions retained on disk. When a new kernel is installed, the oldest kernel is automatically purged to prevent/bootexhaustion.keepcache=0: Set to0to automatically delete downloaded RPM packages after successful installation; set to1to retain downloaded RPM archives incachedir.clean_requirements_on_remove=True: Automatically erases unneeded dependencies when a package is removed (equivalent toautoremove).
6. OpenSUSE Package Management with zypper
In openSUSE and SUSE Linux Enterprise Server (SLES), the high-level package management tool is zypper. It interfaces with the ZYpp engine and supports intuitive, highly compact short subcommands.
| Long Command | Short Alias | Operational Description |
|---|---|---|
zypper install <pkg> | zypper in <pkg> | Installs specified package(s) and dependencies. |
zypper remove <pkg> | zypper rm <pkg> | Removes package(s) from the system. |
zypper update [pkg] | zypper up [pkg] | Applies package updates to installed software. |
zypper dist-upgrade | zypper dup | Performs full distribution upgrade with dependency management. |
zypper search <keyword> | zypper se <keyword> | Searches repositories for matching packages. |
zypper info <pkg> | zypper if <pkg> | Displays detailed metadata of a package. |
zypper what-provides <cap> | zypper wp <cap> | Searches for packages providing a specific capability or file. |
zypper refresh | zypper ref | Refreshes all active repository metadata. |
zypper repos | zypper lr | Lists all configured repositories (-d for URLs, -u for URIs). |
zypper addrepo <uri> <alias> | zypper ar <uri> <alias> | Adds a new repository source. |
zypper modifyrepo <opts> <alias> | zypper mr <opts> <alias> | Modifies repository settings (e.g., -d disable, -e enable). |
zypper removerepo <alias> | zypper rr <alias> | Deletes a configured repository. |
Essential zypper Global Flags
-n,--non-interactive: Automatically answers prompts with their default values for non-interactive scripting.--dry-run: Tests transaction without making filesystem modifications.--no-gpg-checks: Skips GPG signature verification (testing only).
# Perform non-interactive distribution upgrade
$ sudo zypper -n dup
# Search for which package provides /usr/bin/git
$ zypper wp /usr/bin/git
A system administrator needs to identify which package on a Rocky Linux server provides the missing utility /usr/sbin/semanage, even though the package is not currently installed. Which command accomplishes this?
An administrator on an openSUSE Enterprise server needs to perform a distribution-wide upgrade that intelligently handles dependency changes and obsolete packages. Which zypper command should be executed?
After an erroneous package update broke a web server, a RHEL administrator wants to roll back ALL package installations and removals that occurred after transaction ID 15. Which command achieves this?