Logo free mcse ccna rhce linux java learning free mcse ccna rhce linux java learning
          Sharefacebook twitter google+ google bookmark yahoo bookmark delicious digg linkedin pinterest reddit stumbleupon evernote diigo blinklist blogmarks livejournal email feed


Introduction to RedHat Package Manager (RPM)

External Resources

A RedHat Package Manager (RPM) package is a container of files. A typical RedHat Package Manager (RPM) package includes the group of files associated with a specific program or application, which normally includes binary installation scripts as well as configuration and documentation files. It also includes instructions on how and where these files should be installed and uninstalled.

A proper RedHat Package Manager (RPM) file should follow a specific naming convention:


Example: The AVG 8.5 antivirus package for Linux (avg85flx-r287-a2632.i386.rpm) Version, shows the version number and i386 indicates that this package is for intel 32bit processor architecture.

System Architectures used in RPM naming convention




Architecture-independent, can run on any architecture


Generic build for a 32-bit x86 system


Processors like
Pentium I and K6-2 class AMD processors were i586


Intel® Pentium® II, Intel Pentium III, Intel Pentium 4, AMD® Athlon, and
AMD Duron systems


64-bit processors such as AMD Athlon64, AMD Opteron, Phenom and Intel EM64T (Core 2 Duo, Core 2 Quad)


Intel® Itanium™


32-bit IBM® POWER, IBM eServer™ pSeries®, and IBM eServer iSeries


 64-bit IBM eServer System z

How to query RedHat Package Manager (RPM) Database

RedHat Package Manager (RPM) queries can be used to query the RPM database about RPM files. Following are some common rpm query commands

• rpm -qa shows all installed packages

• rpm -qa | wc -l shows the number pf packages


[root@RHEL2 ~]# rpm -qa | wc -l

• rpm -qa | grep -i avgd - shows the information of the avgd package (case insensitive)

[root@RHEL2 ~]# rpm -qa | grep avg

• rpm -qi avg85flx-r287-a2632 - shows the information about the avg85flx-r287-a2632 package


[root@RHEL2 ~]# rpm -qi avg85flx-r287-a2632
Name : avg85flx Relocations: (not relocatable)
Version : r287 Vendor: (none)
Release : a2632 Build Date: Thu 23 Apr 2009 04:27:18 PM IST
Install Date: Sun 05 Jul 2009 05:41:45 AM IST Build Host: michalh-desktop
Group : Applications/System Source RPM: avg85flx-r287-a2632.src.rpm
Size : 136512050 License: (c) 2009, AVG Technologies, s.r.o.
Signature : (none)
Summary : AVG Anti-Virus for Linux
Description :
This package contains the binary release of AVG Anti-Virus for x86 Linux.

• rpm –qf – If the file is associated with an RPM package installed, the name of the package and the version installed is displayed.

Example: The package membership of the specified file (/opt/avg/avg8/bin/avgd, AVG antivirus)

[root@RHEL2 ~]# rpm -qf /opt/avg/avg8/bin/avgd

• rpm –qpi – query a package for information


[root@RHEL2 Server]# rpm -qpi /media/'RHEL_5\ i386\ DVD'/Server/bind-9.3.3-7.el5.i386.rpm
warning: /media/RHEL_5 i386 DVD/Server/bind-9.3.3-7.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Name : bind Relocations: (not relocatable)
Version : 9.3.3 Vendor: Red Hat, Inc.
Release : 7.el5 Build Date: Wed 17 Jan 2007 03:31:13 AM IST
Install Date: (not installed) Build Host:
Group : System Environment/Daemons Source RPM: bind-9.3.3-7.el5.src.rpm
Size : 2189509 License: BSD-like
Signature : DSA/SHA1, Wed 17 Jan 2007 10:26:52 PM IST, Key ID 5326810137017186
Packager : Red Hat, Inc. <>
Summary : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server.
Description :
BIND (Berkeley Internet Name Domain) is an implementation of the DNS
(Domain Name System) protocols. BIND includes a DNS server (named),
which resolves host names to IP addresses; a resolver library
(routines for applications to use when interfacing with DNS); and
tools for verifying that the DNS server is operating properly.

• rpm –ql – queries the contents of the package


[root@RHEL2 bin]# rpm -ql avg85flx-r287-a2632

• rpm -qc – queries the configuration file

• rpm –qd – queries the documentation files

How to install Packages in a Linux computer using rpm command

There are three basic commands that can be used to install an RPM. They won't work if there are dependencies (packages that need to be installed first). You may use the --force option to make rpm ignore dependencies, but that may cause other problems or the installed application will not work properly.

• To install (the package will be installed if it isn't already installed) an RPM package use

# rpm -i packagename

• To Update (upgrades any existing package or installs it if an earlier version isn't already installed) an RPM package use

# rpm -U packagename

• To freshen (Freshen option upgrades only existing packages. It does not install a package if it wasn't previously installed) an RPM package

# rpm -F packagename

The -v and -h options can be added to get more detailed output of the command. -v denotes the verbose mode and -h shows the progress of package installation.


# rpm -ivh packagename

How to verify an installed package using rpm command

Verifying an installed package compares information about that package with information from the RPM database on your system. The --verify (or -V) switch checks the size, MD5 checksum, permissions, type, owner, and group of each file in the package. Here are a few examples:

• rpm –Va – Verifies all packages and display an output if there is a problem

• rpm –Vf – Verifies a file and display an information if there is a problem.


[root@RHEL2 Server]# rpm -Vf /etc/login.defs
S.5....T c /etc/login.defs

RedHat Package Manager (RPM) Failure codes and meaning

 Failure Code



MD5 checksum


File size


Symbolic link (Path Mismatch)


File modification time


Device mismatch


User ownership differs


Group ownership differs


Mode differs (includes permissions and file type)

How to remove an installed package using rpm command

To remove an installed package, run the following rpm command:

rpm -e <packagename>

The removal command will fail, if there is any dependency is there.

If the package that depends on the package you are trying to remove is still needed on the system, you should not try to remove the package. If the package that depends on the package you are trying to remove is also not needed, both must be removed at the same time to resolve the dependency:

rpm -e <packagename1> <packagename1>

              Jajish Thomason Google+
Related Topics
How to compress, uncompress and view files using Linux commands gzip, gunzip and zcat How to compress uncompress view files using Linux commands bzip2 bunzip2 and bzcat How to use Linux tar (tape archive) command to create archives Introduction to YUM (Yellow dog Updater, Modified) Package Manager
comments powered by Disqus

eXTReMe Tracker