The MkLinux Journal
Think Differently. Think MkLinux
Home | About | News | FAQ-O-Matic | Using MkLinux | Advanced Admin |

Using RPM

Introduction

RPM stands for RedHat Package Manager. It is a program you use to install and uninstall packages which contain libaries, programs, man pages, and the like. For example, you may wish to install the gimp, the "Gnu Image Manipulation Program". The gimp consists of several RPMs. What you'll install using rpm depends on your needs, and quite often, what the package requires.

Querying: rpm -qip <file>

Oten you'll want to know about what an rpm provides before doing anything with it. Query a package by using the -qip option.

If you attempt to query a file that is not an rpm or was not downloaded properly, you will get an error. Downloading an rpm in non-binary format (as you can with Fetch under MacOS®) can cause such errors.

Installing: rpm -i <file>

To install an rpm requires root privileges. Become root and invoke rpm with the -i or --install option.

Erasing: rpm -e <file>

To erase or uninstall an rpm, use the -e or --uninstall option. Be careful not to use the full file name for the rpm you wish to uninstall.

Upgrading: rpm -U <file>

Often, rather than using the -i option, you'll want to use the -U or --upgrade option. This option installs a package if it's not already installed. If an older package is installed, then rpm will attempt to remove the old package and install the newer package.

Printing hash marks when upgrading: rpm -Uh <file>

When using rpm to install and unstall packages, you may want to get some more visual feedback. The -h or --hash option prints '#' (hashmark) characters when used in combination with the -i or -U option. For example:

Resolving conflicts and dependencies

Packages often depend on other packages, which is a roundabout way of saying that in order to install a package, you must have other packages installed beforehand. With this in mind, lets try to install the Afterstep window manager before installing Afterstep-APPS.

If we install the APPS RPM first and then the AfterStep RPM, our output is much nicer.

Generally speaking, libraries must be installed before the programs that make use of it. Unfortunately, rpm often does a poor job of telling the user the actual filename of the RPM containing needed libraries. The easiest way to find out what to install is to use the rpm2html database. [Web Team: Unfortunately, MkLinux's rpm2html database no longer exists. Try rpmfind.net.] In our present case, you will want to go to the RPM database sorted by name. Select the first letter "A", then select AfterStep. Scroll down to the "Requires" section and select AfterStep-APPS. You should be taken to a screen where you can view more details about AfterStep-APPS.a

When installing, erasing, or upgrading a package, there are two other options you should be aware of: --nodeps and --force. Suppose for some reason you want to uninstall an rpm and it complains about dependencies. You can get around it by using the --nodeps option.

Other rpm options

The rpm option I use often is rpm -qa. This prints out a list of all the rpms installed on my system. This list can be redirected to another file for easier viewing. We can pipe the command to more or redirect the output to a file for later viewing.

You can even obtain information about an already installed rpm by using rpm -qi (notice that this is not -qip, which is used to query a file).

Another very useful option to use with rpm is --oldpackage. This can be used to downgrade to an earlier version of an rpm should you find an rpm to be unstable. For example, recently I installed ppp-2.3.10-3.ppc.rpm, but discovered that I couldn no longer connect to my isp. Fortunately I still had a backup copy of ppp-2.3.7-2a.ppc.rpm. After I downgraded to this earlier package, my ppp connection was restored.

Word of caution

Whenever you install, upgrade, or uninstall a package, you must be careful of your actions. First, you are logged in as root, so you must remember to log out when you are finished. Second, you must be careful not to try something that has a good chance of corrupting your system. This includes (but is not restricted to) uninstalling essential programs such as bash, perl, and glibc. Note that you must be careful with --nodeps and --force for the same reason.

Using rpms from other distributions and architectures

Installing rpms from other distributions for the PowerPC are generally not a problem. However, the rpm may have different dependencies built into it that may create problems when attempting to install it. In particular, rpms that have been compiled with the older glibc 1.x library are incompatible with rpms compiled with the more recent glibc 2.x library that comes with R1.

If you obtain an rpm with the suffix i386.rpm, that means the rpm was compiled for use on PCs running Linux. An rpm with the noarch.rpm suffix can be installed on any type of computer, including those using the PowerPC. These rpms do not contain programs or libraries that have been compiled specifically for a particular CPU.

RPM command summary

 
CommandDescription
-qip Get information about a package
-qi Get information about a package already installed
-qa List all installed packages
-i or --installInstall a package
-U or --upgradeUpgrade a package
-e or --uninstallErase a package
-h or --hashPrint hash marks
--nodepsDo not check dependencies
--forceIgnore package and file conflicts
--oldpackageDowngrade to an older package

Useful Links

References

Maximum RPM. Bailey, Edward C. Sams Publishing, 1997, ISBN 0-672-31105-4
Home | About | News | FAQ | Getting Started | Using MkLinux | Advanced Admin

Contact the web team at [email protected].

Copyright (©) 2001 MkLinux Developers Association. Permission to freely distribute this document is hereby granted, provided that it is distributed at no charge other than normal connect-time charges. All rights other than those specifically granted above are reserved.