RPM Commands in Linux
Atul.Singh 270002HUVT Visits (1126)
Install an RPM Package
RPM packages have file naming conventions like pack
rpm -ivh pack
rpm -i ftp:
rpm -i http
Un-install an RPM Package
To un-install an RPM package, we use the package name package, not the name of the original package file pack
rpm -e package
Upgrade an RPM Package
To upgrade an RPM package, RPM automatically un-installs the old version of the package package and installs the new package. It is safe to always use rpm -Uvh to install and upgrade packages, since it works fine even when there are no previous versions of the package installed! Also notice that RPM understands FTP and HTTP protocols for upgrading from remote RPM files.
rpm -Uvh pack
rpm -Uvh ftp:
rpm -Uvh http
Query all Installed Packages
Use RPM to print the names of all installed packages installed on your Linux system.
Query an RPM Package
Querying an RPM package will print the package name, version, and release number of the package package only if it is installed. Use this command to verify that a package is or is not installed on your Linux system.
rpm -q package
Display Package Information
RPM can display package information including the package name, version, and description of the installed program. Use this command to get detailed information about the installed package.
rpm -qi package
List Files in Installed Package
The following command will list all of files in an installed RPM package. It works only when the package is already installed on your Linux system.
rpm -ql package
Which package owns a file?
Use the following command to determine which installed package a particular file belongs to.
rpm -qf /usr/bin/mysql
# rpm -qf /usr
List Files in RPM File
Use RPM to query a (possibly) un-installed RPM file with the use of the the "-p" option. You can use the "-p" option to operate on an RPM file without actually installing anything. This command lists all files in an RPM file you have in the current directory. Also note that RPM can query remote files through the FTP and HTTP protocols.
rpm -qpl kern
rpm -qpl ftp:
rpm -qpl http
Verify an Installed Package
Use RPM to list all files that do NOT pass the verify tests (done on size, MD5 signature, etc).
rpm --verify mysql
Where a file does NOT pass, the output is listed using the following codes that signify what failed:
S File size
M Mode (includes permissions and file type)
5 MD5 sum
Take for example the following:
# rpm --verify mysql
S.5....T c /etc/my.cnf
This example indicates that file /etc/my.cnf failed on:
However, the "c" tells us this is a configuration file so that explains the changes. It should still be looked at to determine what the changes were.
Check an RPM Signature Package
RPM can be used to check the PGP signature of specified packages to ensure its integrity and origin. Always use this command first before installing a new RPM package on your system. Also, GnuPG or Pgp software must be already installed on your system before you can use this command.
rpm --checksig package