[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9. Installing and Managing Software with RPM


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.1 What is RPM?

RPM stands for Red Hat Package Manager, and is an easy to use and widely adopted tool for installing, deleting, upgrading, querying and building software packages. There are other systems in use (Debian's DEB for example), though RPM is by far the most popular, and is what you'll get with Red Hat, Mandrake, SuSE and some others.
9.2 What is a Software Package?  
9.3 Using RPM  
9.4 Installing Packages  
9.5 Updating Packages  
9.6 Downgrading Packages  
9.7 Uninstalling Packages  
9.8 Querying packages  
9.9 Resolving Dependency Problems  
9.10 Using RPMFind and RPMBone  
9.11 Circular Dependencies  
9.12 Library Version Problems  
9.13 Automatic Dependency Resolution Tools  
9.14 Miscellaneous  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.2 What is a Software Package?

Under Linux, programs are often distributed as single files known as RPM packages. These packages contain the actual program files, its documentation or manual pages, a summary of what the program does, menu entries and icons, plus information on where each file in the package should be installed. The package also contains information on any other files requires to run the program (dependencies), disk space required and so on. It's not unusual for a program to consist of a hundred or more files, so you can see that packaging them all into a single RPM file greatly simplifies the tasks of adding or removing programs. When you install an RPM package, it is uncompressed and broken down into its individual files which are then put into their correct places. RPM also checks to see whether other files necessary to run the new package (dependencies) are present. Another feature of RPM is the building and maintenance of a database of all packages installed on your computer. This means that you can quickly check to see which packages are installed, the files belonging to a particular package, or the package that provides a particular file.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.3 Using RPM

You can use RPM from the command line, or if you prefer point'n'click, there are several graphical tools available. KDE has a particularly good one named kpackage; there are similar apps for users of other desktop environments, and distribution builders such as Mandrake have their own RPM front ends. I tend to use kpackage for removing un-needed packages to free up disk space, and the command line for everything else; but it doesn't really matter which tool you use. There are significant advantages to becoming familiar with using RPM from the command line; firstly it will be available on any RPM based system you may encounter, regardless of the desktop environment installed, plus it allows you to manage packages on machines that can't or don't run X. The ability to use wild cards (eg.*) to install multiple packages from a group at once is another feature of the command line - for example rpm -ivh mysql*

Just remember that generally speaking, you'll need to be running as root to install, upgrade or delete packages. However any user can run queries.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.4 Installing Packages

In all the examples below, we'll use the Mozilla web browser package as a sample. To install it, first navigate into the directory holding the package, either from the command line or a graphical file manager. This directory might be one of your Linux installation CDs, or your home folder if you've downloaded the package. Using the command line, you would type:
rpm -ivh mozilla-0.9.8-10mdk.i586.rpm (your version of Mozilla might be different..)
Note that you only need to type in the complete file name when you are working with a package that is not yet installed, otherwise the basic package name (in this case "mozilla") is enough. And don't forget the tab key to auto-complete the long file names. If you prefer graphical tools, clicking on the RPM file in most file managers (Konqueror for example) will open the appropriate tool, or you can right click and use the "Open With" dialog box. It's then just a matter of clicking the `Install' button.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.5 Updating Packages

Updating an existing program with a later version is done in almost exactly the same way as installing. From the command line:
rpm-Uvh mozilla-0.9.8-10mdk.i586.rpm (note the uppercase "U")
Or click the `Update' button from kpackage or similar tools.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.6 Downgrading Packages

What if you upgrade, and then find that you preferred the older version? You can use the `"--oldpackage"' option from the command line like this:
rpm -Uvh --oldpackage mozilla-0.9.8-10mdk.i586.rpm.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.7 Uninstalling Packages

To uninstall from the command line:
rpm -e mozilla(the complete package name isn't required)

Or start your graphical tool, either from the menu or a terminal. You'll see a list of all the installed packages. Click on the package you want to remove, then click the `Uninstall' button. Note that if there are other packages installed that require files from the one you are deleting, a warning will appear and the uninstall won't go ahead. You can override this by using
rpm -e --nodeps mozilla (command line),
or selecting "Ignore Dependencies" (GUI tool), but be aware that this will break the other programs.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.8 Querying packages

Listing all installed packages is easy. From the command line type:
rpm -qa
If the list is too big to view you can pipe it through less like this:
rpm -qa | less
Graphical tools will usually show the list of installed packages on start up.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.8.1 Listing all of the files installed by a package

This is done with the rpm -ql command. Using mozilla again as an example we would type:
rpm -ql mozilla
Under a GUI tool just select the package and then click on the " File List" (or equivalent) button. Listing all of the files supplied by a package not yet installed - is done with the rpm -qpl command. Requires the complete file name.
Eg. rpm -qpl mozilla-0.9.8-10mdk.i586.rpm.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.8.2 Listing a description of an installed package

can be performed with the rpm -qi command. For example:
rpm -qi mozilla.
Using a GUI tool, just click on the desired package. To see a description and other information of an package not yet installed, use the rpm -qpi command. You'll need to use the complete file name for this one. For example:
rpm -qpi mozilla-0.9.8-10mdk.i586.rpm.
With a GUI, select the package, or just click on the file from within your file manager (eg. Konqueror)


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.8.3 To find the package to which a file belongs

To find the package to which a file belongs is done with the rpm -q --whatprovides command. Example:
rpm -q --whatprovides/usr/lib/mozilla/xpicleanup


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.8.4 To list all the packages a package depends on

Use rpm -qR like this:
rpm -qR -mozilla
(For a package not yet installed use rpm -qpR, with the full file name )
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.9 Resolving Dependency Problems

The most common problem encountered when installing software is an unsatisfied dependency. You might be already familiar with this problem if you've installed new software under Windows and then found it refuses to run, with a "missing ***DLL" error message.

Linux is subject to the same problems, except that RPM will advise you of the problem before the program is installed. Many problems can be avoided when you install Linux - selecting Gnome and KDE for installation will help, even if you don't intend to run them, as many other programs use the same libraries.

So what do you do when RPM complains that a package can't be installed, because of missing packages or files. Write down the missing package/file names, and check your installation CD-ROMs for packages with similar names to the ones required. You can use the rpm-qpl command to view the files supplied by a not-yet-installed package. Often it is just a matter of installing these packages to resolve the problem. Sometimes, though, it leads to even more dependencies, so it can be a rather lengthy process.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.10 Using RPMFind and RPMBone

There is another extremely useful tool for finding files and packages, and that's the RPMFind website. Type the name of the needed file or package into the box on the main page and click on the search button; you'll then be presented with some relevant information and links to the package. Often you'll already have the package on your Linux CDROM - using the information from RPMFind you'll know which one to look for.RPMFind can provide a list of dependencies for a package; the file names in this list link back to their parent package. Usually, there is also a link to the package's home site. RPMBone is another site that's useful for finding and downloading RPM packages, and is somewhat similar to RPMFind. RPMBone has a more flexible search function; you can narrow down your search to only give results for a certain distribution or architecture for example. It also provides links to a huge number of ftp servers for downloading. If you need to find a package containing a particular file to satisfy a dependency however, RPMFind should be your first stop.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.11 Circular Dependencies

Occasionally, you might come across a circular dependency. This is when package A won't install because package B is missing, but when you try to install package B, RPM complains that package A is missing. What you do here is use the `--nodeps' option. For example:
rpm -ivh --nodeps mozilla-0.9.8-10mdk.i586.rpm.
If you are using a GUI tool, click on the "Ignore Dependencies" button.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.12 Library Version Problems

Sometimes a package will refuse to install because it requires a library file version later than the one already installed. This is easily fixed by upgrading the package to which the file belongs. While library files are usually backwards compatible, occasionally a package will refuse to install because a certain version of a file is missing, even though a later version is present. While you could downgrade the library package, this might well break other programs. Try creating a symbolic link with the name of the older library file that points to the existing newer version. If for example the package you are trying to install insists on having foo.so.3, and you already have foo.so.4 installed in /usr/lib, do this (as root): ln -s /usr/lib/foo.so.3 /usr/lib/foo.so.4


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.13 Automatic Dependency Resolution Tools

Automatic Dependency Resolution Tools are available with some distributions. Mandrake for example has `urpmi', RedHat has `up2date',while Ximian has RedCarpet. There are also tools like apt4rpm. These can automatically download and install required packages for you. See your distributions documentation or the relevant website for details.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.14 Miscellaneous


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.14.1 RPM Version Incompatibilities

You probably won't have to worry about this unless your Linux installation is fairly old. Earlier Linux distributions were packaged with version 3.x of RPM, and are unable to handle the later 4.x series of packages. The exception to this seems to be version 3.05, you could update RPM to this version, or just replace your distribution with something newer. The RPM 4.x series is backwards compatible with the older series.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.14.2 Midnight Commander

Occasionally you might want to copy files from an RPM package without actually installing it. You can do this with a file manager known as mc (for Midnight Commander). Despite being somewhat ugly, it is extremely capable. It is supplied (though not always installed by default) with most distributions, and can be started from a terminal window by typing mc. You can then navigate around the package as if it was a normal folder, and copy individual files from it.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.14.3 Learning More

This article only covers the bare basics of RPM, if you'd like to learn more you could read the RPM manual page (type man rpm), or follow the links below:
RPM One Liners - A concise guide by Brian Jones, worth downloading and printing for reference.
The RPM How-To - The "official" how-to at the Linux Documentation Project.
Maximum RPM - An extremely thorough guide to just about anything that can be done with RPM. (All these resources were used in the writing of this article)


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated on March, 5 2003 using texi2html
Hosted by www.Geocities.ws

1