rpm
rpm
The rpm
command is a package management tool for managing RPM (Red Hat Package Manager) packages. It is used in Red Hat-based distributions, such as Fedora, CentOS, and RHEL (Red Hat Enterprise Linux). The rpm
command allows users to install, query, verify, update, and remove RPM packages.
Basic Usage
Installing a Package
To install an RPM package, use:
Options:
-i
: Install the specified package.
Removing a Package
To remove an installed package, use:
Options:
-e
: Erase (remove) the specified package.
Upgrading a Package
To upgrade an existing package or install it if it's not already installed, use:
Options:
-U
: Upgrade the specified package.
Querying Packages
To query installed packages or specific package files, use:
Options:
-q
: Query the specified package.
Example: To query if a package is installed:
To get detailed information about an installed package:
Options:
-i
: Display package information.
Listing Files in a Package
To list files installed by a package, use:
Options:
-l
: List the files in the package.
Verifying a Package
To verify the integrity and authenticity of an installed package, use:
Options:
-V
: Verify the specified package.
Importing a GPG Key
RPM packages can be signed with GPG keys to ensure their integrity. To import a GPG key:
Advanced Usage
Installing from a Repository
For installing packages from repositories, you would typically use yum
or dnf
(the newer package manager for Fedora and RHEL-based distributions). However, you can combine rpm
with yum
/dnf
if you need to:
Or with dnf
:
Force Install/Upgrade
To forcefully install or upgrade a package, ignoring some dependency issues:
Options:
--force
: Force the installation or upgrade.-v
: Verbose mode.-h
: Print hash marks as the package archive is unpacked.
Checking Dependencies
To check the dependencies of an RPM package:
Options:
-p
: Query a package file.-R
: List the requirements (dependencies) of the package.
Example Usage
Installing a Package
To install a package named example-1.0-1.x86_64.rpm
:
Querying a Package
To get information about the installed httpd
package:
Listing Files in a Package
To list all files installed by the httpd
package:
Verifying a Package
To verify the integrity of the httpd
package:
Conclusion
The rpm
command is an essential tool for managing software packages on Red Hat-based systems. It provides a comprehensive set of options for installing, querying, verifying, updating, and removing packages. Understanding how to use rpm
effectively can help you manage your system's software efficiently.
help
Last updated