✦ For everyone, free.

Practical knowledge for real and everyday life

Home

RPM Package Management

RPM Package Management handles Linux software installation, updates, and removal using RPM files and tools like rpm and yum.

RPM Package Management is a powerful and widely used system for managing software packages on Linux distributions. It provides tools and standards to build, install, upgrade, query, verify, and erase software packages, ensuring consistency and integrity in software management. The core of the system revolves around the RPM Package Manager (RPM), which handles packages in the .rpm file format, containing compiled software binaries, metadata, and scripts.


RPM Package Management Architecture

RPM Package

An RPM package is an archive file with a .rpm extension that bundles software components along with metadata describing the package. This metadata includes the package name, version, release, architecture, dependencies, file list, and scripts to be executed during installation or removal. The metadata format and conventions are standardized to allow consistent handling by RPM tools.

NEVRA: Package Identity

Each RPM package is uniquely identified by its NEVRA attributes:

  • Name: The package name.
  • Epoch: An optional integer used to override version comparisons.
  • Version: The upstream software version.
  • Release: The package build release number.
  • Architecture: The hardware architecture the package is built for.

Together, these form the package identity, crucial for transaction and dependency management.

RPM Database

RPM maintains a local database that stores information about all installed packages, including their NEVRA, installation date, file lists, and scripts. This database allows querying installed packages, verifying file integrity, and resolving dependencies during transactions.


RPM Transactions

Transaction Concept

RPM transactions are atomic operations that install, upgrade, or remove packages. The transaction system ensures system consistency by performing all operations as a single unit: if any step fails, the transaction can be rolled back or aborted to prevent partial changes.

Dependency Resolution and Script Execution

Before executing a transaction, RPM resolves package dependencies, ensuring all required packages are present or will be installed. RPM scripts embedded in packages (pre-install, post-install, pre-uninstall, post-uninstall) are executed at appropriate stages during transactions to handle configuration, cleanup, or other tasks.

Transaction States

Transactions go through several states such as preparing, installing, verifying, and finally completing. RPM maintains transaction logs for auditing and troubleshooting purposes.


Package Management Tools: DNF5 and Zypper

DNF5

DNF5 (Dandified Yum version 5) is a modern package manager built on top of the RPM system. It enhances dependency resolution, performance, and modularity. DNF5 handles package installation, upgrade, and removal, providing a user-friendly command-line interface and API, while managing RPM transactions under the hood.

Zypper

Zypper is another advanced package manager primarily used in SUSE-based distributions. It interfaces with RPM to perform package management tasks while providing powerful dependency resolution, repository management, and pattern-based package selection.

Both tools leverage the RPM infrastructure but extend its capabilities to improve usability and automation in complex environments.


RPM Package Management Workflow

Building RPM Packages

Developers use the RPM build system, including spec files, to create RPM packages. The spec file defines the build instructions, metadata, dependencies, and scripts. The build process compiles source code, packages binaries, and generates the final .rpm archive.

Installing and Upgrading Packages

When installing or upgrading, RPM tools:

  1. Check for existing packages and dependencies.
  2. Download required packages if using a repository.
  3. Verify package integrity and signatures.
  4. Execute pre-install scripts.
  5. Install package files.
  6. Execute post-install scripts.
  7. Update the RPM database.

Querying and Verifying Packages

RPM provides commands to query installed packages, list files, check dependencies, and verify file integrity and signatures. This facilitates system audits and troubleshooting.

Removing Packages

Package removal involves executing pre-uninstall and post-uninstall scripts, deleting files, and updating the RPM database to reflect the change, ensuring no orphaned files remain.


Summary

RPM Package Management is a foundational component in Linux software management, providing a robust, transactional system for handling software packages. Its structured package format, comprehensive metadata, and integrated database enable consistent and reliable package operations. Advanced tools like DNF5 and Zypper build upon RPM to offer enhanced usability and automation, making RPM an essential technology in Linux infrastructure and operations.

Content in this section