rpm command in Linux (package management)
The rpm command is responsible for installing, removing, updating, converting the packages. This command is first organized into operating modes, which may be: querying, verifying, integrity, installing, removing, updating, and rebuilding the rpm database. Each operating mode may or may not contain several options available.
The rpm is related to the Debian dpkg, and it also requires that each dependency be satisfied manually, as well as the packages downloaded manually. These are rarely used commands when it comes to installing packages in the distribution repositories, since Yum is apt are very versatile, but they allow third-party packages to be installed manually.
The most common operating modes are:
To query the database
Example:
To check the status of the packages
Example:
To verify the signature and integrity of the packages
Example:
To install a new package:
Example:
To install a new package showing installation details:
To update a package:
Example:
Package libpcap-0.7.2-37 is already installed
To remove a package:
Example:
To redo the RPM database:
Example:
To query a package’s dependencies:
Example:
To install a package ignoring dependencies (a very stupid thing to do):
Example:
To list recently installed packages:
Example:
To find out which package a file belongs to:
Example:
To learn information about a particular installed package:
Example:
To verify the integrity of the files installed with the package database:
Example:
The most common package information query options are:
-
- a List all packages installed on the system;
- -f file: Lists the name of the package containing the searched file;
- -p packagename: Shows whether a particular package is installed;
- -i package-name: Shows extra information about a particular package;
- -l package-name: Shows the list of files a package contains;
- -R package-name: Shows the list of dependencies that a package needs to be installed.
The most common package installation and upgrade options are:
- —force: This option forces the installation of a package and its files even if it is already installed. This option even forces the installation of an older package on top of a newer one;
- -h: This option shows the installation progress;
- ---nodeps: This option disables the dependency check for installing a package;
- -v: Show extra information during the installation and upgrade of the packages;
- -vv: Shows much more information during the installation and upgrade of the packages. Generally used by developers.
The options for uninstalling the packages are:
- —nodeps: Disables dependency checking, uninstalling the package even if it is needed by others;
- —test: Tests the removal of the package without actually removing it. It is useful for testing whether removing the package will cause any damage to the system or application.
Prefer to use the —U mode when updating a package to a newer version, so the older package will be removed, the new package will be installed, and the settings will be maintained.
As you can see, the use of rpm is complicated at first sight and impractical, since the administrator has to download the packages and install the dependencies manually. To make everything easier, RPM-based distributions adopted YUM.
Learn how to configure the Pfsense firewall in practice with the Linux Certification Pfsense Firewall Training!
You can register here. If you already have an account, or want to create one, just log in or create your user here.