RPM is one of the most powerful utility that gives you full flexibility to install, modify, delete or upgrade and to customize your package or application on your linux machine. The tool allows system administrators and users to install, update, uninstall, query, verify and manage system software packages in Unix/Linux operating systems. This utility only works with packages that built on .rpm format.

1) RPM keeps the information of all the installed packages under /var/lib/rpm database.

2) To check the rpm manual then just type at the command prompt as man rpm (or)               rpm –help.

3) To check the packages currently installed on our system : rpmqa

4) To check for a particular package : rpmqa | grepi firefox

5) To Know how many packages installed on our system (Count) : rpmqa |wc -l

6) To Know about the entire information about a particular product: rpmqi firefox     —- This displays the information about the firefox version, release, install date and so on.

7) Before installing a package first we have to know the software and version the linux. For example we want to install a package on CentOS Linux machine first we have to know the version of the CentOS. For that simply execute the command : cat /etc/redhat – release

8) Now go to the mirror.centos.org — here you can find the list of rpm’s that you can install on the CentOS Linux.

9) For example if you want to install the gftp product and you are having the rpm available then click on that rpm and save that file on your machine.

10)  If we want to know the information about the rpm package then use:

            rpmqpi rpmpackagename.  (qpi — Query Package information, qi – query information, qa – query all). Ex: rpm -qpi gftp-2.0.18-3.2.2.i386.rpm

11) Install an RPM :  rpm –ivh filename (i-install, v-verbose, h-hash)

            Example: rpmivh gftp-2.0.18-3.2.2.i386.rpm

12) For uninstalling the RPM package which we have installed then use: rpmev gftp.

13) For upgrading the software use: rpm -Uvh gftp-2.0.18-3.2.2.i386.rpm (U-upgrade, v-verbose, h-hash).

14) We haven’t installed the package or we don’t want to install the package but we want to upgrade the package use:

             rpm –Fvh softwarename (ex: rpm –Fvh gftp-2.0.18-3.2.2.i386.rpm). (F- freshen)

15) To verify the file or to verify if you have correct version of the package use:

             rpm -VF /usr/bin/gftp (V- verify, F- file). (Here we have moved the gftp to gftp.bk and then we have written some garbage in the gftp file).

16) To verify all the packages: rpmVa (V-verify, a-all).

17) To verify a particular package: rpmVp filename.

18) For listing the dependency packages: rpmqRP rpmfilename.

19)  For checking the RPM signature package use the following command: rpm –checksig pidgin-2.7.9-5.el6.2.i686.rpm.

20) To check dependencies of the RPM Package before installing use the following command:  rpmqpR BitTorrent-5.2.2-1-Python2.4.noarch.rpm (q-query, p-list capabilities this package provides, R – list capabilities on which this package depends).

21) Installing a RPM package without dependencies: rpm -ivh –nodeps BitTorrent-5.2.2-1-Python2.4.noarch.rpm

22) For listing the recently installed RPM packages: rpm -qa –last

23) For removing an RPM package without dependencies: rpm -ev –nodeps filename.

24) To import an RPM GPG Key: rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6.

25) To rebuild the corrupted RPM Database: 1) cd /var/lib 2) rm _db* 3) rpm –rebuild 4) rpmdb_verify Packages.

26) To list all the files in a RPM package: rpmqlp rpmpackagename (q- query, l-list all the files in the package, p-specify the package name).

27) To find the state of the files in an RPM package: rpmqsp rpmpackagename (q-query, s- state, p-specify the package name).