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.
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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
