Introduction & command examples of RPM Package Manager

RPM Package Manager:

RPM stands for Red hat Package Manager. It is a powerful package manager tool for Redhat, open-suse, fedora etc. RPM can be used to install, build, verify, update, query and remove individual application or software packages.
RPM is default package manager for RedHat Linux systems.
RPM are basically files which contain installable software and that package has .rpm extension or suffix.
RPM is a free tool created or developed by Redhat software.
RPM will store information about packages in a database "/var/lib/rpm".

Advantages of RPM Package Manager:

  • Straightforward program installation and uninstallation
  • Automatic installation
  • Ease of updating programs originally installed with RPM
  • Availability of versions for most distributions of Linux

Disadvantages of RPM Package Manager:

  • Distribution packages
  • Architecture-specific
  • Dependency

Some sites where you get RPM Packages:

There are five basic options use for RPM command

  • Install    : It is used to install any RPM package.
  • Remove : It is used to erase, remove or un-install any RPM package.
  • Upgrade : It is used to update the existing RPM package.
  • Verify     : It is used to query about different RPM packages.
  • Query     : It is used for the verification of any RPM package.

Some Useful RPM Command Examples:

1. Install RPM Package

This command will help you to install .rpm package. One thing keeps in mind to run rpm command you must have root access on the system.

$ rpm -ivh mozilla-mail-1.7.5-17.i586.rpm

-i : install
-v : verbose
-h : print hash marks as the package archive is unpacked.


2. Upgrade package

To upgrade package just replace the "-i" option with a capital "-U".

$ rpm -Uvh mozilla-mail-1.7.6-12.i586.rpm

3. Erase/remove/ an installed package

To remove/erase already installed package use "-e" option.

$ rpm -ev mozilla-mail

4. Erase/remove/ an installed package without checking for dependencies

$ rpm -ev --nodeps mozilla-mail

-e : erase/remove
-v : verbose

5. Display list all installed packages

To display a list of all installed packages use below command.

$ rpm -qa
$ rpm -qa | less

-q : Query a Package
-a : all

6. Display installed information along with package

This command will help to display information about the package with version and a short description.

$ rpm -qi mozilla-mail

-q : Query Package
-i  : install

7. Find out what package a file belongs to.

This is a very important command which helps to find out what package own the file or what package file belongs to.

$ rpm -qf /etc/passwd
$ rpm -qf /bin/bash

-q : Query Package

8. Display list of configuration file(s) for a package

$ rpm -qc {pacakge-name}
$ rpm -qc httpd

9. Display list of configuration files for a command

$ rpm -qcf /usr/X11R6/bin/xeyes

10. Display list of all recently installed RPMs

$ rpm -qa --last | less

11. Find out what dependencies an rpm file has

$ rpm -qpR mediawiki-1.4rc1-4.i586.rpm

-q : Query a package
-p : List capabilities this package provides.
-R : List capabilities on which this package depends.

12. Find out which files are installed with any .rpm file

$ rpm -qlp mozilla-mail-1.7.6-12.i586.rpm

13. Installing package Ignoring Dependencies

$ rpm -ivh --nodeps pants.rpm

14. Verify MD5

$ rpm -k <.rpm>

15 Rebuild corrupted RPM DB

Sometimes rpm database gets corrupted and stops all the functionality of rpm and other applications on the system. So, at the time we need to rebuild the rpm database and restore it with the help of the following command.

$ cd /var/lib
$ rm __db*
$ rpm --rebuilddb
$ rpmdb_verify Packages

I hope you like the article if you find any difficulties then please do comment your queries or problem via the comment section, till then stay tuned to techthings.org for more such valuable articles. 

Latest Comments
  1. dlightdaily December 5, 2016
  2. D.light December 24, 2016
  3. KUMAR NIKHIL January 27, 2017
  4. Tim February 1, 2017

Leave a Reply

Your email address will not be published. Required fields are marked *