This document contains an overview of the principal RPM commands for installing, uninstalling, upgrading, querying, listing, and checking RPM packages on your Red Hat Linux system.
This document uses apache rpm httpd-2.0.49-4.i386.rpm , as an example.
- About RPM naming conventions
- Installing RPMs
- Upgrading existing RPMs
- Removing RPMs
- Lising installed packages
- Finding Package information
- Lising files in an installed packages
- Finding the association of a file to RPM
- List files in RPM package from local or remote destination .
- verify an installed package
All rpms follow the similar naming conventions
package name version release architecture Package Type
httpd 2.0.49 4 i386 rpm
name is a name describing the packaged software.
version is the version of the packaged software.
release is the number of times this version of the software has been packaged.
architecture is the type of computer hardware rpm is meant to run on for example i3836,alpha ,Sparc,mips,ppc,SGI,m68k ) .
It may also be the string
noarch – no artitecture – indicating package is not hardware specific..
nosrc – no source – means it has only package building files and
src – Source – means it contains the package building files and the software’s source code.
For RPMs present locally
# rpm -ivh
-i Install
-v Verbose
-h Print 50 hash marks as the package archive is unpacked.
For RPMs present on remote ftp location
# rpm -i ftp://
For RPMs present on remote http location
# rpm -i http://
# rpm -Uvh httpd-2.0.52-12.i386.rpm
# rpm -Uvh ftp://
# rpm -Uvh http://
Notes:
– Upgrade uninstalls the old package and installs the new one
– If installing kernel use the install option as that will install new kernal as a new package and you can use old version if new does not work. Upgrade will remove the old version and you can’t go back .
# rpm -e httpd
This is the simplest way of removing a package. only package name is needed. Package is simply deleted and no information is displayed.
To see what is going on, use the following
#rpm -evv httpd
All packages installed on the system
# rpm -qa
q – query
a – all
Single Package – installed in the system
# rpm -q httpd
httpd-2.0.52-12
# rpm -qi httpd
gives following information about httpd package
Name : httpd Relocations: (not relocatable)
Version : 2.0.52 Vendor: (none)
Release : 0 Build Date: Thu 13 Mar 2008 05:11:13 AM PDT
Install Date: Fri 08 May 2010 08:18:45 PM PDT Build Host: mybuildhost.domain.com
Group : System Environment/Daemons Source RPM: httpd-2.0.52-12.src.rpm
Size : 7982208 License: Distributable
Signature : (none)
Packager : sysadmins group
Summary : The httpd Web server
Description :
# rpm -ql httpd
# rpm -qf /usr/local/httpd/bin
httpd-2.0.52
# rpm -qpl httpd-2.0.52-12.i386.rpm
# rpm -qpl ftp://
# rpm -qpl http://
# rpm –verify httpd
To verify an installed package. This command will list all files that do NOT pass the verify tests (done on size, MD5 signature, etc). Where a file does NOT pass, the output is listed using the following codes that signify what failed:
S File size
M Mode (includes permissions and file type)
5 MD5 sum
L Symlink
D Device
U User
G Group
T Mtime
Take for example the following:
# rpm –verify mysql
S.5….T c /etc/my.cnf
This example indicates that file /etc/my.cnf failed on:
File size
MD5 Sum
Modified Time
However, the “c” tells us this is a configuration file so that explains the changes. It should still be looked at to determine what the changes