(Modified 2009 Sep 15)

RPMs
RedHat Package Management


Outline


What are RPMs?

While probably most of the programs available for Linux are open-source, meaning the source code is freely available, most normal people will not care to compile the source code from scratch.

With that in mind, RPMs are pre-compiled binary packages for Linux. This means someone else compiled the program on their own machine, and packaged them into something of the form PACKAGE_NAME.rpm.

The good news is that the user doesn't have to compile anything him/herself. The bad news is that the binaries will be specific to a particular hardware/software setup.

As far as hardware goes, the main variability likely to cause problems is the processor. People with Pentiums and Athlons will probably be okay, as those CPUs are 32-bit and 386-compatible. People with Opterons (64 bits) might be in trouble, as those CPUs aren't very prevalent yet, and random coders are less likely to have pre-compiled binaries on 64-bit machines.

After hardware, software setup is the other condition that will be computer-specific, particularly the distribution of Linux.


Where to get RPMs? RPMs are typically tracked by various websites, with links to various mirrors, or repositories containing copies of the RPM.

Here are some links to find RPMs

Once at these sites, you'll want to find the RPM most applicable to your system setup. Asssuming you just want the binaries and don't want to compile from source, avoid the RPMs that have "src" in the name. These RPMs with "src" likely have just the source code packaged and not the binaries.


Package installation

Help is available by typing at the Unix prompt man rpm. The examples below will hit on the main points of the manual page.

The general syntax to install PACKAGE_FILE is:
rpm -ivh PACKAGE_FILE
where:


Testing installation

The installation might not run without error the first time you attempt it; it probably won't. This is because programs are not independent; they depend on other programs. This situation is referred to as a "dependency."

In a way, it's a good thing that programs depend on other, common programs. It means that the programmer is not re-inventing the wheel every time he, for example, wants to open up a file browser. The bad news is that you don't generally know this is going to happen, until you try to install a package, and it fails. The dependency problem is, in my opinion, something that is going to hold Linux back when Joe Schmoe tries to use it.

Anyway, you can run a mock/practice installation of PACKAGE_FILE with the --test flag:
rpm --test -ivh PACKAGE_FILE

If there are dependency problems, they will show up here. I'm not sure if testing installation saves any more harm than just having the installation fail, but I feel better about it, like I'm doing the right thing, and that's what's important.

If you do have a dependency problem, it will show up like this:

[root@localhost vim]# rpm -i --test vim-X11-6.1-14.i386.rpm 
warning: vim-X11-6.1-14.i386.rpm: V3 DSA signature: NOKEY, key ID db42a60e
error: Failed dependencies:
        vim-common is needed by vim-X11-6.1-14

What do you do if this happens? In the example above, I'd have to look for vim-common. I'd do this by looking at one of the websites linked above, like pbone.net, or I'd use a general search engine, like Google, for "vim-common rpm fedora" . Then, I'd install the requisite package(s) before re-attempting to install the package I wanted in the first place.


Uninstallation

If you decide you don't want a given PACKAGE_FILE, you use the -e flag:
rpm -e PACKAGE_FILE


Package upgrading

To upgrade PACKAGE_FILE, the syntax is:
rpm -U PACKAGE_FILE

The --test flag should prove useful, i.e.:
rpm --test -U PACKAGE_FILE


Package info

You can look up some useful information using the -q flag (for query), which has the syntax
rpm -q [options] PACKAGE_FILE
where some options are:


yum/Synaptic

Lately, it is often unnecessary to install packages one at a time and manually resolve dependencies. The command-line program yum automatically checks for dependencies and installs the requisite packages. Some useful yum commands:

yum does not seem to list the files present in a package. To show this information, use the command:

repoquery --list PACKAGE_FILE

I've gotten where a yum process would die, and I'd get a database error the next time(s) I would run yum (or rpm). The fix is described here. In summary:

The graphical program Synaptic is outstanding. If a package is listed here, this is by far the easiest path to installation. On my Ubuntu systems, this is the default package manager. On my Fedora system, it does not seem to be exhaustive. So, I attempt to install programs in the following rank:

  1. Synaptic
  2. yum (or on Ubuntu, apt)
  3. rpm

This page is Lynx-enhanced