Skip to content
Mastering RPM: Essential Commands for Installing, Querying, and Verifying Linux Packages
Operations 8 min read

Mastering RPM: Essential Commands for Installing, Querying, and Verifying Linux Packages

This guide explains the RPM package manager’s naming conventions, core commands for installing, removing, upgrading, querying, and verifying packages, and how to initialize or rebuild the RPM database on Linux systems.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations

Overview

RPM (RPM Package Manager) packages compiled programs into one or a few files, enabling installation, removal, upgrade, and query operations.

RPM package naming

Format: name-version-release.arch.rpm. Example: bash-1.1.0-5.el6.x86_64.rpm, where bash is the software name, 1.1.0-5 the version, and el6.x86_64 indicates the target OS release and architecture.

Basic RPM commands

Install : rpm -i /path/to/package.rpm Remove : rpm -e package_name Upgrade (or install if absent) : rpm -U /path/to/package.rpm Common options: -v: show detailed installation progress -h: display progress bar (each “#” = 2%)

Example installation with progress flags: rpm -ivh bash-1.1.0-5.el6.x86_64.rpm Additional options: rpm --test /path/to/package.rpm: test installation without performing it rpm --replacepkgs /path/to/package.rpm: force reinstall, overwriting existing files

Note : Removing a package that other packages depend on will also remove those dependents unless the --nodeps option is used, which may leave dependent software broken.

Common query commands

rpm -qa

: list all installed RPM packages. rpm -qf /path/to/file: find which package owns a specific file. rpm -qi package_name: display detailed information about an installed package. rpm -ql package_name: list files contained in an installed package. rpm -qip /path/to/package.rpm: show information about an RPM file without installing it. rpm -qlp /path/to/package.rpm: list files contained in an RPM file.

Verification and integrity

rpm -V package_name

: verify installed package files; output letters indicate mismatches (S size, M mode, 5 digest, D device, L readlink, U user, G group, T mtime, P capabilities). A dot (.) means no change. rpm -K /path/to/package.rpm: manually check package integrity (e.g., RSA, SHA1 signatures).

Database management

rpm --initdb

: initialize the RPM database if it does not exist. rpm --rebuilddb: rebuild the RPM database, overwriting the existing one.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxpackage managementRPM
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.