Would you like a very fast and easy way to install RPM packages? You may find this hard to believe, but at times opening up a shell and typing commands can be much faster than going through all those graphical steps. I'll show you how it is done in this extended Shell Out session. Let's pretend you have just downloaded some great package, and now the RPM file for it is sitting in one of your directories. Using a hypothetical package of my invention, let's install that package with command-line rpm:
cd /directory_where/package_lives rpm -ivh ftl-transport-2.1-1.i386.rpm
The only thing you need to be aware of here is that package installation needs to be done as the root user. The command that does all the work is called rpm. The flags that I am passing to it tell rpm to install the package (the -i flag), to be verbose (the -v flag), and to print out little hash marks while it does its work (the -h flag). Note that you do not have to have a dash before each letter option (-i -v -h) you can combine them instead (-ivh):
# rpm -ivh ftl-travel-2.1-1.i386.rpm ftl-travel #########################################
If you want to know everything that is happening, drop the -h flag and add two more v's. The results are pretty wordy, but you do get to see what is happening during the various stages of the installation as well as what files are being installed and where.
Upgrading an existing package is just as easy. As part of the process, older versions of files will be replaced, and the package's default configuration files may be moved or renamed to preserve the originals (you will usually see appropriate messages if this occurs). Upgrading is more or less the same as installing except that you use the -U flag on the command line instead of the -i flag:
rpm -Uvh matter_transporter-1.2-1.i386.rpm
To erase a package, use the -e flag instead:
rpm -e matter_transporter
Notice that when I delete the package, I don't add the release number extensions (the -2.1-1.i386.rpm type of suffix).
A full-blown Linux installation will have a lot of packages installed. If you are curious, you can list every single package by typing the following command:
rpm -qa | sort | more
That shell command is actually three in one. The rpm -qa portion tells rpm to query the RPM database and list all the packages. The bar that you see is called the pipe symbol. It literally means to pipe the output of the first command into the second command. The second command in this case is sort. After the packages have been listed and sorted, we pipe that output one more time into the more command. In other words, show me a screen full of information, and then pause before showing me more. To see the next page, press the spacebar. To quit the listing, type the letter q by itself.
RPM can tell you a lot about the packages you have installed. To find out what version of the fileutils package you have on the system and what it is, use the -q flag along with the -i flag:
$ rpm -qi fileutils Name : fileutils Relocations: (not relocateable) Version : 4.1.11 Vendor: MandrakeSoft Release : 5mdk Build Date: Wed 28 Aug 2002 08:39:42 AM EDT Install date: Sun 20 Oct 2002 10:00:04 AM EDT Build Host: ke.mandrakesoft.com Group : File tools Source RPM: fileutils-4.1.11-5mdk.src.rpm Size : 2344533 License: GPL Packager : Thierry Vignaud <email@example.com> URL : ftp://alpha.gnu.org/gnu/fetish/ Summary : The GNU versions of common file management utilities Description : The fileutils package includes a number of GNU versions of common and popular file management utilities. Fileutils includes the following tools: chgrp (changes a file's group ownership), chown (changes a file's ownership), chmod (changes a file's permissions), cp (copies files), dd (copies and converts files), df (shows a filesystem's disk usage), dir (gives a brief directory listing), dircolors (the setup program for the color version of the ls command), du (shows disk usage), install (copies files and sets permissions), ln (creates file links), ls (lists directory contents), mkdir (creates directories), mkfifo (creates FIFOs or named pipes), mknod (creates special files), mv (renames files), rm (removes/deletes files), rmdir (removes empty directories), sync (synchronizes memory and disk), touch (changes file timestamps), and vdir (provides long directory listings)
Using -l instead of -i will list all the files in the package. You can even do a sort of reverse file listing by asking rpm to look in its database to identify what package a particular file belongs to. To find out what package a file belongs to, use the -f flag. For example, in my /sbin directory is a file called sysctl. If I want to know where this file came from and what package it belonged to, I use this command:
# rpm -qf /sbin/sysctl procps-2.0.7-14mdk
To discover all the things the rpm command can do for you, type man rpm, and you will be able to read the manual page related to that command. As you can see, it really isn't all that complicated to work from the command line. If you prefer the graphical tools, then by all means use them. But don't be afraid of using the shell when you have the opportunity.