Using RPM

Created on June 27, 1998
Last updated on December 31, 1999
Development stage: Beta

RPM is the Red Hat Package Manager, developed by Red Hat Software. It's a packaging format used in several Linux distributions, such as Red Hat, Mandrake, Caldera OpenLinux, and TurboLinux. The RPM homepage is at

Since RPM is a package manager, you can install, remove, build, rebuild, and view your packages. In this document I will cover everything except building RPM software packages, which you probably won't need to do right now.

Installing RPM Packages

Your Linux distribution, if it uses RPM, already installed RPM packages. You can install additional RPMs from your CD-ROM or download them from an FTP server. RPM packages end in ".rpm".

The most basic syntax for installing an RPM package is rpm -i package-1.2.3-4.i386.rpm. RPM file names usually consist of the package name ("package"), the version ("1.2.3"), the build number or patch level by Red Hat ("4"), the architecture it was built to run on, ("i386"), and the "rpm" extension.

Instead of using just "-i" in the RPM command line to install RPMs, you probably want to use "-ivh" so you can see what's going on.


Sometimes you have to force a package to install, because maybe you had it installed, but some of its files got deleted and you want to have the complete package again. Simply add "--force" to your RPM command line while installing a package. If you don't, you'll probably get complaints that the package is already installed.

If you're forcing a package to install, your command line will then look something like rpm -i --force package-1.2.3-4.i386.rpm. Forcing a package to install usually won't hurt anything, but don't use the "--force" option all the time.


Often, new versions of software come out, and new RPM packages are built for them. That's when the "-U" flag of RPM becomes useful. That's a capital "U", not a lowercase "u".

If there's an update to the previous package we had, it would be noted in the filename. So an upgrade to "package-1.2.3-4.i386.rpm" would be something like "package-2.0.3-1.i386.rpm". To install it, the command line looks like rpm -U package-2.0.3-1.i386.rpm.

Like installing, you can also see more of what's going on. Instead of just "-U" you can use "-Uvh".

Listing Files from a Package

A lot of the time, it may be hard to figure out what program to run after installing the RPM package for it. Using rpm -ql packagename will give you a list of all the files that are part of the package. This may be useful also for finding where its default configuration file is located.

It may also help to pipe the output through less, if there are a lot of files in the package. Simply type rpm -ql packagename | less. less is cool, and it is your friend.

Removing RPM Packages

If you don't want to have a package around anymore, you can remove it. Use the "-e" flag for rpm. Let's say we want to remove the package installed by package-1.2.3-4.i386.rpm. Don't type the entire filename. Just type something like rpm -e package-1.2.3-4. Even rpm -e package-1.2.3 will work, if there aren't more RPM packages of package-1.2.3 lying around, which may have been installed with the "--force" flag.

Ignoring Dependencies

Many RPM packages depend on other RPM packages to run. A lot of cases are programs that need libraries to run, or programs that need other programs to run. It's generally a bad idea to remove packages without paying attention to what depends on those packages, which RPM warns you about on default, unless you use the "--nodeps" flag.

RPM will also complain about dependencies if you try to upgrade a bunch of packages. Upgrading also involves removing the old package, so you can use the "--nodeps" flag with upgrading as well.

Viewing All Packages

To get a simple printout of all the packages you have installed through RPM, use the command rpm -qa. It's as simple as that.

Checking for a Package

To see what packages you have installed, use their names to find them. For example, if we want to find all RPM packages installed that have "pack" somewhere in their names, we type rpm -qa | grep pack.

What we're doing there is printing out all the packages but sending it to the grep program so that grep can search for the text string we specified ("pack").

Viewing Package Information

To find out information about our package, type rpm -qi package-1.2.3. The "-q" we've been using so far stands for Query, and the "i" stands for Information.

Here's a sample output from a package called "perl":

Name        : perl                        Distribution: Manhattan
Version     : 5.004                             Vendor: Red Hat Software
Release     : 6                             Build Date: Fri May  8
12:08:09 1998Install date: Tue Jun 16 10:36:49 1998   Build Host:
Group       : Utilities/Text                Source RPM:
Size        : 11696746
Packager    : Red Hat Software 
Summary     : Practical Extraction and Report Language
Description :
Perl is an interpreted language optimized for scanning arbitrary text
files, extracting information from those text files, and printing reports
based on that information.  It's also a good language for many system
management tasks.  The language is intended to be practical (easy to use,
efficient, complete) rather than beautiful (tiny, elegant, minimal).

As you can see, there's a lot of good, detailed information you can find by using rpm -qi.

Rebuilding an RPM from a Source RPM

There are few situations that the typical user will actually need to rebuild RPM packages, but I had to do it when I upgraded my JPEG library. The programs that used the JPEG library wouldn't load JPEGs just because I had a new version and they were expecting an older version.

I had to take the source RPM packages of those programs and use them to rebuild into an RPM package. That way they would expect the correct version of the JPEG library I had installed. One of those packages was the GIMP. I took the source RPM (gimp-1.0.0-1.src.rpm) and typed rpm --rebuild gimp-1.0.0-1.src.rpm. That recompiled it, re-linked it with the new JPEG library so it would know what version to expect, and created three RPM packages. That's what the .src.rpm files are for: they're source RPMs for people who need to rebuild the package for some reason.

Related Pages

  1. Installing Software Packages

Questions, comments, and suggestions should be sent to joshuago at users dot sourceforge dot net through e-mail, the guestbook, or help.html.

Copyright © 1997-1999 Joshua Go (joshuago at users dot sourceforge dot net). All rights reserved. Permission to use, distribute, and copy this document is hereby granted. You may modify this document as long as credit to me is given.