The rpm
command is a package management tool for RPM-based Linux distributions. It is used to install, upgrade, query, verify, and remove software packages.
Overview
Installing Packages
To install a package using rpm
, use the following command:
rpm -i <package_name.rpm>
For example, to install the htop
package, run:
rpm -i htop-2.2.0-3.el8.x86_64.rpm
Upgrading Packages
To upgrade a package, use the following command:
rpm -U <package_name.rpm>
For example, to upgrade the htop
package, run:
rpm -U htop-2.2.0-3.el8.x86_64.rpm
Querying Packages
To list all installed packages, use the following command:
rpm -qa
To query information about a specific package, use the following command:
rpm -qi <package_name>
For example, to query information about the htop
package, run:
rpm -qi htop
Verifying Packages
To verify the integrity of an installed package, use the following command:
rpm -V <package_name>
For example, to verify the htop
package, run:
rpm -V htop
Removing Packages
To remove an installed package, use the following command:
rpm -e <package_name>
For example, to remove the htop
package, run:
rpm -e htop
Options
The following table lists the available options for the rpm
command:
Option | Description |
---|---|
-i | Install a package |
-U | Upgrade a package |
-q | Query installed packages |
-qi | Query information about a package |
-V | Verify an installed package |
-e | Remove an installed package |
Troubleshooting Tips
- If you encounter dependency issues during package installation, use the
--nodeps
option to skip dependency checks. However, this should be used with caution as it may cause issues with your system. - If you encounter issues with package installation or removal, try running the command with the
--force
option to override any errors or warnings. Again, this should be used with caution as it may cause issues with your system.
Notes
rpm
is the primary package management tool for RPM-based Linux distributions such as Red Hat Enterprise Linux, CentOS, and Fedora.- It is recommended to use a package manager such as
yum
ordnf
instead ofrpm
for managing packages, as they handle dependencies and other issues automatically.