Originally Published: Monday, 18 December 2000 Author: Cody Powell
Published to: learn_articles_firststep/General Page: 1/1 - [Printable]

Red Hat Package Manager: A Better Way To Install Software

One of the most daunting tasks for new users is adding software. In Windows, you had good ol' Install Shield where all you had to do was point and click and Bob's-your-uncle. In Linux, though, you've got to do tar -xvzf file, ./configure, make, make install and then offer a sacrifice to your box so it won't stop in the process. There has to be a better way!

   Page 1 of 1  

RPM Stands for Red Hat Package Manager (not Really Pretty Monkeys as many think) and it is the better way to install. With RPM, installation seems effortless; all you have to do is type one line most of the time and the rest is done for you. What's more, you can also uninstall packages and verify your system to see what you could be missing. To see everything you can do with RPM, type rpm --help in your shell and prepare to be astonished. Or at least surprised.

RPM comes with most Linux distributions today, but if you're one of those unlucky souls who lacks it, you'll need to go to ftp.redhat.com and then follow the steps in the README to install. To understand how to install with RPM, you'll need to go grab some packages. So, head on over to http://rpmfind.net and find something interesting.

When you are looking at packages, you'll generally see something like yaddayadda-1.3.1-i386.rpm. That first part (yadda yadda) is the package name, and the 1.3.1 is the version number. The i386 (or possibly i586 or maybe even PPC) part tells you that this is a binary package; if it has src instead of i386, it is a source package. Binary packages come pre-compiled, so are a little easier to install.

Having downloaded your package, you now need to go into a shell and cd over to the directory you downloaded to. To do rpm stuff, you have to be root, so do an su if you haven't already. If this package is a binary package, you can install it with:

rpm -ivh yaddayaddayadda-1.3.1-i386.rpm
(note: to save yourself time, don't type the whole package name out; just type out the first few letters and then hit Tab to autocomplete).

I specified three options there with my -ivh. The i means that I want to install, the v means that I want to verify that I have this package's dependencies installed, and the h means that I want to see my progress displayed with hash marks. If you're the adventurous sort, you can just install with -i.If you want to be bombarded with information on how the installation is going, try using -ivv to install in debug mode. If you're installing a source package, it's a good idea to specify -ivv in case of an error. Also, if you want to install a package off of an ftp site or a Web site, just do

rpm -ivh ftp.redhat.com/whatever.rpm
and it will work.

There are tons of options you can specify when you are wanting to install. Rather than go through them all here, sometimejust take a look at man rpm. Some of the more popular options are --replace files (replace files from old packages with the new files in the package), --force (install despite error messages), --nodep (install without doing a dependency check, and --test (will simulate install to see if it goes smoothly).

Let's say you messed up and you don't want yaddayaddayadda-1.3.1-i386.rpm on your machine anymore. To uninstall this package, do

rpm -e yaddayaddayadda-1.3.1-i386.rpm
and things will be taken care of.

Perhaps you installed an old version of the yaddayaddayadda package and you want to update to the newest version. You could uninstall the package and then reinstall the package, or you could use rpm's handy upgrade function. To use that, type

rpm -Uvh yaddayaddayadda-1.3.2-i386.rpm
The upgrade function's syntax is just like the syntax of the install function.

One more cool function of rpm is its query function. Let's say you are unsure of which version of yaddayaddayadda you have installed. If you are, you could type rpm -q yaddayaddayadda and it would come with yaddayaddayadda-1.3.1. If you do rpm -ql packagename, it will show you the full list of the files it installed on the system. If you want to know more about a certain package, do an rpm -qi packagename to see all sorts of stuff. You can do an

rpm -qa
to see the full list of packages on your computer. Let's say one day you are looking around in some directories and you see some strange files. One really cool part of the query function is that you can determine which package a file belongs to, so you won't go off and delete things madly. To see this, type
rpm -qf strangefilename

One final cool feature of rpm is that you can verify the packages on your system to see any discrepancies/missing files. To do one on a particular package, do

rpm -V packagename
To do one for the whole system, just type
rpm -Va

RPM is a good part of Linux, but it isn't fool-proof. There will be times when you're using it that the package just won't install and you'll have to find another version of the file and do it yourself. Despite all of this, though, RPM remains an important tool in any Linux user's toolbox.





   Page 1 of 1