RPM Package Manager Commands
The RPM Package Manager (RPM) is a powerful command-line tool used for managing software packages on Linux distributions like Fedora, CentOS, RHEL, and SUSE. It allows users to install, update, remove, query, and verify software packages efficiently.
Essential RPM Commands for Package Management
Below are some of the most frequently used RPM commands to help you manage your Linux system's software.
Installing and Updating Packages
---
tags: [ packaging ]
---
# To install a package:
rpm -ivh <rpm>
# To update a package:
rpm -Uv <rpm>
Removing Packages
# To remove a package:
rpm -e <package>
# To remove a package, but not its dependencies
rpm -e --nodeps <package>
Querying Package Information
# To find what package installs a file:
rpm -qf <file>
# To find what files are installed by a package:
rpm -ql <package>
rpm -qpl <rpm>
# To find what packages require a package or file:
rpm -q --whatrequires <package>
rpm -q --whatrequires <file>
# To list all installed packages:
rpm -qa
Verifying and Checking Dependencies
# To find a packages's dependencies:
rpm -i --test <package>
# To display checksum against a source:
rpm -K <package>
# To verify a package:
rpm -V <package>
Understanding RPM Command Options
The options used with the rpm command are crucial for its functionality:
-i: Install a package.-U: Upgrade a package.-e: Erase (remove) a package.-v: Verbose output.-h: Print hash marks as the package manager progresses.-q: Query mode.-f: Query the package that owns the specified file.-l: List files in a package.-p: Query an uninstalled package (usually a .rpm file).--nodeps: Do not check for dependencies when removing a package.--whatrequires: List packages that require the specified package or file.-a: Query all installed packages.--test: Perform a dry run to check dependencies without installing.-K: Verify the package's signature and checksums.-V: Verify the integrity of an installed package.