📚 How To Master the RPM Command
As a Linux user, you've likely encountered RPM (Red Hat Package Manager), a powerful package management system used by various Linux distributions including Red Hat, CentOS, Fedora, OpenSUSE, and more. RPM is known for its simplicity, ease of use, and enhanced security features. In this guide, we'll explore the RPM command and its practical use cases, from installing and upgrading packages to querying and verifying them. Let's get started!
What is RPM?
RPM, or Red Hat Package Manager, is a free and open-source package management system that allows you to install, update, remove, verify, and query RPM packages on your Linux system. RPM packages are stored in repositories, and the RPM command-line tool provides you with easy access to a vast array of software packages. Most RPM packages are binary files with pre-compiled software that are compatible with specific Linux distributions and system architectures.
The Basics: Installing, Updating, and Removing RPM Packages
To manage RPM packages, you'll need to use the
rpm command along with specific options. Here are some fundamental commands to get you started:
Install: To install an RPM package, use the
-ioption followed by the package file name. For example:
sudo rpm -ivh package.rpm
-voption provides verbose output, while the
-hoption shows a progress bar.
Upgrade: To upgrade an existing RPM package, use the
-Uoption. The package will be upgraded to a newer version if available:
sudo rpm -Uvh package.rpm
If the package has any missing dependencies, RPM will list them, and you'll need to install them manually.
Remove: To remove (erase) an installed RPM package, use the
-eoption followed by the package name:
sudo rpm -e package_name
To remove a package without checking its dependencies, use the
Querying and Verifying RPM Packages
To retrieve information about RPM packages and verify their integrity, you can use the following commands:
Query: To query whether a specific package is installed, use the
sudo rpm -q package_name
To get more detailed information, use the
-qioption. Additionally, you can use the
-qloption to list all the files in the installed package.
Verify: To verify the integrity of an installed package, use the
sudo rpm -V package_name
RPM will check file ownership, permissions, and other metadata, and report any discrepancies.