Sh - RPM package (RPM: Red Hat Package Manager)

> Procedural Languages > Bash Shell and (Unix|Linux) Utilities (XCU)

1 - About

RPM packages are .cpio files and you can unpack their contents.

The Red Hat Package Manager (RPM) is a toolset used to build and manage software packages on UNIX systems. Distributed with the Red Hat Linux distribution and its derivatives (CentOS is 100% compatible rebuild of the Rehat Enterprise Linux).

The rpm files represent application or package that you can install on Linux system.

If you don't have them, you can find them via rpmfind

They are managed through:


3 - Package naming scheme

The naming scheme of RPM files is itself a standardized convention. RPMs have the format


For example, the name cat-2.4-7.i386.rpm would mean an RPM :

  • for the utility “cat”
  • version 2.4, build 7
  • for the x86 (When the platform name is replaced by “src”, it's a source RPM)

4 - How to

4.1 - install them

4.1.1 - With the shell


# with ''rpm''
rpm -ivh myRpm.rpm
# same as 
yum localinstall myRpm.rpm

Remotely via repo: Example on how to install Samba

rpm -i samba* 
        > Output: error: Failed dependencies:  perl(Convert::ASN1) is needed by samba-3.0.33-3.7.el5.i386
rpm -i samba-3.0.33-3.7.el5.i386
        > Output: error: open of samba-3.0.33-3.7.el5.i386 failed: No such file or directory
rpm -i samba*
        package samba-common-3.0.33-3.7.el5.i386 is already installed
        package samba-client-3.0.33-3.7.el5.i386 is already installed

More ...How can I install or upgrade a package? Can I install an old one?


4.1.2 - Gnome gui

On Red Hat / Oracle Entreprise Linux

With the Gnome gui

4.1.3 - user scope

unzip them.

RPM packages are .cpio files, and you can unpack their contents with the cpio utility.

rpm2cpio my.rpm | cpio -idv

4.2 - see if a package is already installed ?

An interesting command for checking if a package is installed or to find out all packages that match a string is:

rpm -qa | grep -i python 


  • q = query
  • a = all

4.3 - deinstall a package ?

From the command above, take the package name (without the architecture and rpm extension) and perform the following command

rpm -e package


  • e = erase

4.4 - Documentation Location

The location of the documentation for installed packages is:


For example, the documentation for the redhat-config-date software package is located in


4.5 - Repository

  • Install a key
# Microsoft repository key
sudo rpm --import

4.6 - List

List a package or groups of packages

yum list

4.7 - Info

yum info python
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Installed Packages
Name       : python
Arch       : x86_64
Version    : 2.4.3
Release    : 56.el5
Size       : 73 k
Repo       : installed
Summary    : An interpreted, interactive, object-oriented programming language.
URL        :
License    : PSF - see LICENSE
Description: Python is an interpreted, interactive, object-oriented programming
           : language often compared to Tcl, Perl, Scheme or Java. Python includes
           : modules, classes, exceptions, very high level dynamic data types and
           : dynamic typing. Python supports interfaces to many system calls and
           : libraries, as well as to various windowing systems (X11, Motif, Tk,
           : Mac and MFC).
           : Programmers can write new built-in modules for Python in C or C++.
           : Python can be used as an extension language for applications that need
           : a programmable interface. This package contains most of the standard
           : Python modules, as well as modules for interfacing to the Tix widget
           : set for Tk and RPM.
           : Note that documentation for Python is provided in the python-docs
           : package.

4.8 - Find / provide

Find what package provides the given value

yum provides *GLIBCXX_3.4.8*
libstdc++-4.1.2-50.el5.i386 : GNU Standard C++ Library
Repo        : ol5_u6_base
Matched from:
Other       :

4.9 - Build a package

4.10 - Modify

rpmrebuild can be used to:

  • build an rpm file from an installed package (lost rpm)
  • or to quickly make change to a package: just have your change on installed files and call rpmrebuild.

5 - Documentation / Reference