rpm
Manage Red Hat Package Manager (RPM) packages
TLDR
Show version of httpd package
List versions of all matching packages
Forcibly install a package regardless of currently installed versions
Identify owner of a file and show version of the package
List package-owned files
Show scriptlets from an RPM file
Show changed, missing and/or incorrectly installed files of matching packages
Display the changelog of a specific package
SYNOPSIS
rpm {-i|-U|-F|-q|-V|-e|--rebuilddb} [OPTIONS] [PACKAGE_FILE | PACKAGE_NAME | ARGUMENTS]...
PARAMETERS
-i, --install
Installs an RPM package file. Does not upgrade existing packages.
-U, --upgrade
Upgrades an existing RPM package or installs it if not present.
-F, --freshen
Freshens an existing RPM package. Installs only if an older version is already present.
-e, --erase
Erases (uninstalls) an installed RPM package by its name.
-q, --query
Queries the RPM database for information about packages. Requires an additional query option.
-qa
Lists all installed packages.
-qi
Displays information about an installed package.
-ql
Lists all files belonging to an installed package.
-qc
Lists configuration files belonging to an installed package.
-qd
Lists documentation files belonging to an installed package.
-qf FILE
Determines which installed package owns a given file.
-qp PACKAGE_FILE
Queries information about an uninstalled RPM package file.
-V, --verify
Verifies the integrity of an installed package against its original metadata.
-Va
Verifies all installed packages.
--nodeps
Ignores package dependencies during install, upgrade, or erase operations. Use with caution!
--force
Forces installation/upgrade/erase, ignoring file conflicts or package verification errors.
--prefix PATH
Relocates a relocatable package to an alternative path.
--root DIR
Operates on an alternative root directory for package installations.
--dbpath PATH
Uses an alternative RPM database path.
--rebuilddb
Rebuilds the RPM database from the installed package headers. Useful for database corruption.
DESCRIPTION
The rpm (Red Hat Package Manager) command is a powerful, low-level package management tool used primarily on Red Hat-based Linux distributions like Fedora, CentOS, and RHEL. It allows users to install, update, query, verify, and uninstall software packages distributed in the .rpm format.
Unlike higher-level package managers such as yum or dnf, rpm operates directly on individual package files and does not automatically resolve dependencies or manage software repositories. This makes it a fundamental tool for system administrators and developers who need precise control over package operations, troubleshooting, or building custom packages. While it provides detailed information about installed software, its direct usage is often superseded by `yum` or `dnf` for day-to-day operations due to their enhanced dependency resolution and repository management capabilities.
CAVEATS
rpm is a low-level tool that does not automatically handle package dependencies or repository management. Incorrect use, especially with options like --nodeps or --force, can lead to a broken system or dependency hell. For most common package management tasks, higher-level tools like dnf or yum are recommended as they provide robust dependency resolution and integrate with software repositories.
KEY MODES OF OPERATION
The rpm command operates in several distinct modes, determined by the primary option used:
• Install/Upgrade Mode: Used with -i, -U, or -F to add new packages or update existing ones on the system. For example, rpm -i package.rpm.
• Query Mode: Activated by -q, this mode retrieves information about installed packages or .rpm files. It's often combined with other options like -qi (info), -ql (list files), or -qf (find package owning a file).
• Erase Mode: Uses -e to remove an installed package from the system. For instance, rpm -e package_name.
• Verify Mode: With -V, this mode checks the integrity and authenticity of installed packages by comparing them against their original metadata. rpm -Va verifies all installed packages.
HISTORY
The rpm command and the RPM Package Manager were originally developed by Red Hat, Inc. in 1997. It quickly became the standard package management system for Red Hat Linux and subsequently for other distributions in the Red Hat family, such as Fedora, CentOS, and SUSE Linux. Its introduction provided a structured way to distribute, install, and manage software on Linux systems, moving beyond simple archives. While foundational, its lack of automatic dependency resolution led to the development of higher-level tools like up2date, then yum, and more recently dnf, which abstract away the complexities of dependency management and repository handling. Despite these advancements, rpm remains an essential utility for system administrators for low-level package operations, troubleshooting, and scripting.