The Red Hat Package Manager, known commonly as RPM, is a powerful software package tool that can be used on various Linux distributions. Package managers provide a means by which software is installed and indexed on your Linux system. Not only that, they can gracefully remove software when it is no longer required. This allows for speedier installs and uninstalls and facilitates better system administration. While there are several package managers available, usually based on a particular distribution, none of them is as well known or as widely used as RPM. In this article, we will look at how you install, track, and remove software with the powerful RPM utility.
Installing from the command line
The RPM program itself is run from the command line using the aptly named command rpm. You can get a quick rundown of the switches and options available to you by executing rpm without any switches. You will see a number of possible options, and this will give you an idea of everything you can accomplish with RPM.
While you may never need to go beyond simple installation syntax of RPM, it’s always good to know your options. If you look near the top of the program’s output, you'll see the main switches required to install a piece of software. One of the more common methods you will find in documentation is to run rpm –ivh <package>. If, for instance, you just finished downloading the latest version of Tux Racer, you would move to the directory where you downloaded it and then install it using the following command:
rpm –ivh tuxracer-0.61-5.i386.rpm
The i switch tells RPM that a new installation will be occurring. The v switch tells it to operate verbosely (to provide output on what is happening during the installation). The h switch tells RPM to output hash marks to indicate the progress of the installation. If you are running into problems and want more information about what RPM is doing, try adding an extra v switch. This will increase the level of verbosity and show what is being done and what files are being accessed.
Behind the scenes, RPM is doing more than just installing the package’s contents onto your system. It performs a dependency check, looks for conflicts, processes any developer scripts, and keeps track of everything it did. When you look at all the steps RPM takes for any installation, it is easy to see how much help it can be. If you want to know in advance whether an installation will succeed, simply run the command with the switch –test:
rpm –ivh --test tuxracer-0.61-5.i386.rpm
This will run RPM through its usual installation process but will not actually install any software or make changes to your system. This is a nice feature and one that will help you maintain a clean system that's free of partial installs.
Installing from URLs
RPM also provides a means to install from URLs. This can save a step or two, as you do not have to download and save a package prior to running the RPM command. Installing with URLs is done as follows:
rpm -ivh ftp://ftp.gnome.com/pub/rpms/games/tuxracer-0.61-5.i386.rpm
RPM will automatically attempt to access FTP sites anonymously. If that access is not available, the program will prompt you for a username and password. Now, of course, you may wonder where to find these files or URLs. An excellent first stop is either RPMfind.net or RedHat.com. Both sites have large databases of software packaged into RPMs. If you can't find what you’re looking for there, try a simple Web search from an engine such as Google. Maintainers and developers usually have multiple package types available on their Web sites.
You may also want to check out one of the graphical front ends to RPM, such as KPackage, Glint, and Gnome-RPM. These utilities can be used under X-Windows to perform, via a friendly GUI, just about everything you could at the command line. In KPackage, for instance, all you need to do is click on the filename in a directory listing to install the package (see Figure A).
|KPackage provides a graphical front end to RPM.|
This is a great way to install the packages you need without having to use the command line. The dependencies are listed before you even attempt an install, so you can see what you will need to install the package before you execute any commands. Don’t worry if you are not sure what you currently have installed. RPM will still check and let you know what you are missing.
Software that has been installed with RPM can also be easily removed, which is one of the main advantages of using a package manager such as RPM. To remove software, simply run rpm –r <package name>. RPM will read its database and remove files originally installed. For example, to remove the TuxRacer package we installed above, we would run the command:
rpm –r tuxracer-0.61-5.i386.rpm
When removing files with RPM, remember that you need to use the package name, as opposed to the filename of the package you installed. This is good because you may not have the original package itself. RPM will then update its database with this new information, and you're all set.
Red Hat's up2date
As mentioned earlier, by default, RPM will check for dependencies necessary to install any software package. Unfortunately, it will not install these dependencies if they are missing, nor will it tell you how to find them. Sometimes, you may find yourself searching for, downloading, and installing multiple packages just to be able to install the one you originally wanted. This will become easier as programs that fetch and install dependencies automatically become more widespread.
An example of this can already be seen with Red Hat’s up2date system. This program will automatically attempt to download and install any needed dependencies when you use it to retrieve packages. While RPM is still used locally for the installation, a lot of the legwork is done for you. I would advise taking a look at this program, as it will help streamline installations and Linux administration, saving you time and headaches.
Package managers provide an excellent resource for installing, managing, and removing software on your Linux system. This is clearly evident with RPM, the Red Hat Package Manager. There is no need to worry about installing from source or keeping track of where programs are installed. RPM does it all. Not only that, RPM will check dependencies and let you know if you are missing software that is needed to make the installed program work. Whether you are installing locally, from an FTP site, or through a GUI, RPM can help you keep your Linux systems in order and install Linux software effectively and efficiently.
Have a comment or a question?
We look forward to getting your input and hearing about your experiences regarding this topic. Post a comment or a question about this article.