|[Home] [Credit Search] [Category Browser] [Staff Roll Call]||The LINUX.COM Article Archive|
|Originally Published: Sunday, 12 September 1999||Author: Joshua Go|
|Published to: news_learn_firststep/Firststep News||Page: 1/1 - [Printable]|
If you run one of the many distributions that are based off of RedHat Linux then you most likely have come in contact with RPM, the package management program. There is much more to this program then just package installation. Learn how to maintain an organized system.
|Page 1 of 1|
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 Linux, Caldera OpenLinux, and TurboLinux. The RPM homepage is at http://www.rpm.org.
Since RPM is a package manager, you can install, remove, build, rebuild, and view your packages. In this document I'll 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 comes 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".
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.
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: porky.redhat.com Group : Utilities/Text Source RPM: perl-5.004-6.src.rpm Size : 11696746 Packager : Red Hat Software
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.
Questions, comments, and suggestions should be sent to firstname.lastname@example.org.
Copyright © 1997-1999 Joshua Go (email@example.com). 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.
|Page 1 of 1|