Overview
rpm is a core tool for managing software packages on Red Hat-based Linux systems. It provides functionality for installing, removing, updating packages, and querying information about installed packages on the system. As a low-level package management tool, dependency resolution often needs to be handled manually.
Key Features
- Install and update RPM packages
- Remove installed packages
- Query package information (installation status, file list, metadata, etc.)
- Verify package file integrity
Key Options
The `rpm` command offers various modes and options to perform different tasks. The main modes include installation (-i), update (-U), removal (-e), query (-q), and verification (-V).
Install/Update Options
Remove Options
Query Options
Generated command:
Try combining the commands.
Description:
`rpm` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Demonstrates various scenarios for managing packages using the `rpm` command.
Install an RPM Package
sudo rpm -ivh mypackage-1.0.0-1.x86_64.rpm
Installs a local `.rpm` file. Dependency issues may occur.
Update or Install an RPM Package
sudo rpm -Uvh mypackage-1.0.1-1.x86_64.rpm
Updates the package if it's already installed, or installs it if it's not.
Remove an Installed Package
sudo rpm -e mypackage
Removes the specified package from the system.
List All Installed Packages
rpm -qa | less
Lists the names and versions of all RPM packages installed on the system.
Query Specific Package Information
rpm -qi httpd
Checks detailed information for the installed 'httpd' package.
List Files of a Specific Package
rpm -ql httpd
Lists all file paths included in the installed 'httpd' package.
Find Package Owning a Specific File
rpm -qf /etc/passwd
Determines which RPM package installed the `/etc/passwd` file.
Tips & Warnings
`rpm` is powerful but is a low-level package management tool. For tasks requiring dependency management, using higher-level tools like `yum` or `dnf` is generally recommended.
Recommended to Use Higher-Level Tools
- Utilize YUM/DNF:
rpmdoes not automatically resolve dependency issues. When installing or updating packages with complex dependencies, using package managers likeyum(older versions) ordnf(newer versions) is much more convenient and safer. These tools are built on top ofrpmand provide dependency resolution capabilities.
Dependency Issues
- Manual Resolution: When using
rpm -iorrpm -U, errors will occur if required libraries or other packages are not installed. In such cases, you must manually install the necessary dependency packages first.
Caution with Force Options
- --force / --nodeps: Options like
--forceor--nodepscan compromise system stability and should be avoided unless absolutely necessary. They can lead to unpredictable issues on your system.