RPM Documentation

RPM Documentation:

What is an RPM?

RPM is also called as the Red Hat Package Management system. This is an freely published set of specifications and tools to allow Linux and Unix vendors to package their software in a way that is amenable to automated installation upgrade, removable and administration. Although it has Red Hat's name in it —- it has been adopted by most of the major Linux distribution maintainers.

1.Basic Concepts of RPM

The RPM Package Manager (RPM) is a powerful command line driven package management system capable of installing, uninstalling, verifying, querying, and updating computer software packages. Each software package consists of an archive of files along with information about the package like its version, a description, and the like.

An RPM package will be of the form


2.Different Modes of Usage


In the simplest form to install a package (foo version 1.2 in this example), you can use commands like:

rpm -i foo-1.2.rpm


Suppose you have the package foo-1.2 installed. If you have the newer version of that package (say foo-1.3), then you can upgrade the package. This is how its done.

rpm -U foo-1.3.rpm

You can also let rpm do the FTP for you with a command like:

rpm -U ftp://myserver.myorg.net/upgrades/bar-2.2.rpm

this will upgrade the bar version 2.2 package


You can query a list of files from an installed package with


list all of the packages that you have installed on the whole system

rpm -qa


you can verify a package with a command like:

rpm -V foobar

which will give you a summary of every change to the checksums, ownership, permission, timestamp, etc —- of every file that was part of the "foobar" package.

Combination of RPM features:

Combining these in a relatively obvious way you can check every package on your system with the following:

rpm -qa | xargs rpm -V

You can also find out which package a given file "belongs to" with a command like:

rpm -qf /some/file/that/was/installed/by/something



rpm {-q|--query} [select-options] [query-options]
       rpm {-V|--verify} [select-options] [verify-options]
       rpm --import PUBKEY ...
       rpm {-K|--checksig} [--nosignature] [--nodigest] PACKAGE_FILE ...


rpm {-i|--install} [install-options] PACKAGE_FILE ...
       rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...
       rpm {-F|--freshen} [install-options] PACKAGE_FILE ...
       rpm {-e|--erase} [--allmatches] [--nodeps] [--noscripts] [--notriggers] [--repackage] [--test] PACKAGE_NAME ...


rpm --import PUBKEY ...
       rpm {--checksig} [--nosignature] [--nodigest]

The —checksig option checks all the digests and signatures contained in PACKAGE_FILE to ensure the integrity and origin of the package. Note that signatures are now verified whenever a package is read, and —checksig is useful to verify all of the digests and signatures associated with a package.

Digital signatures cannot be verified without a public key. An ASCII armored public key can be added to the rpm database using —import. An imported public key is carried in a header, and key ring management is performed exactly like package management. For example, all currently imported public keys can be displayed by:

rpm -qa gpg-pubkey*

Details about a specific public key, when imported, can be displayed by querying. Here’s information about the Red Hat GPG/DSA key:

rpm -qi gpg-pubkey-db42a60e

Finally, public keys can be erased after importing just like packages. Here’s how to remove the Red Hat GPG/DSA key

rpm -e gpg-pubkey-db42a60e


These options can be used in all the different modes mentioned above.

-?, —help Print a longer usage message then normal.
—version Print a single line containing the version number of rpm being used.
—quiet Print as little as possible - normally only error messages will be displayed.
-v Print verbose information - normally routine progress messages will be displayed.
-vv Print lots of ugly debugging information.

—rcfile FILELIST Each of the files in the colon separated FILELIST is read sequentially by rpm for configuration information. Only the first file in the list must exist, and tildes will be expanded to the value of $HOME. The default FILELIST is


—pipe CMD Pipes the output of rpm to the command CMD.
—dbpath DIRECTORY Use the database in DIRECTORY rather than the default path /var/lib/rpm

—root DIRECTORY Use the file system tree rooted at DIRECTORY for all operations. Note that this means the database within DIRECTORY will be used for dependency checks and any scriptlet(s) (e.g. %post if installing, or %prep if building, a package) will be run after a chroot(2) to DIRECTORY.

To roll back the RPM transaction, use the —rollback option followed by the rollback target. If an hour after upgrading foo, you decide you don't want it, you could type:

rpm -Uvh --rollback '2 hours ago'
    rpm -Uhv –-rollback ‘9:00 am’
    rpm -Uhv –-rollback ‘december 25′
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.