-->
Previous | Table of Contents | Next |
RPM is not restricted to Red Hat Linux; it has appeared in several different versions of Linux. RPM is a character-based system that allows you to build, install, query, verify, update, and uninstall software packages. (A software package in Linux terms consists of an archive of files and information about that package, such as the package name, version number, and a brief description.) RPM has ten modes of operation, each with a different set of options. This can make RPM a little confusing to work with, although most of the uses are straightforward. RPMs modes and their purposes are shown in Table 5.1.
Mode name | Command line | Used for |
---|---|---|
Build | rpm -[b|t]O | Build a package |
Fix permissions | rpm --setperms | Fix the permissions on a package |
Install | rpm -i | Adding new software |
Query | rpm -q | Check to see what packages and files are installed |
Rebuild Database | rpm --rebuilddb | Rebuild the package database |
Set owners and groups | rpm --setugids | Set the owner and group of a package |
Show RC | rpm --showrc | |
Signature check | rpm --checksig | Check the package to ensure there are no errors |
Uninstall | rpm -e | Remove a package |
Verify | rpm -V|-y| --verify | Verify that a package is installed properly (all files installed) |
We wont bother with a lot of detail about all these options because most are self-explanatory and covered in the documentation, but a few common-usage examples will help you become more familiar with RPM. To install software with RPM, you need to specify the package name that you want to install. The syntax of the install command is as follows:
rpm -i [install-options] <package_filename>
There are dozens of installation options possible, most of which dont do very much except modify the behavior of RPM slightly. A few of the more useful installation options for RPM are
Check the man page for a full list of options. The packagee name to be added is usually given as a complete path, although a URL is also possible with many versions of RPM. To install a package called Xgames, the command would be given like this:
rpm -i /mnt/cdrom/col/install/Xgames.rpm
In this case, the package is called Xgames.rpm, and the full path to the package is given (this one is on a CD-ROM in the colcollectionsdirectory).
The verify mode of the RPM command is handy for making certain that all portions of a package have been installed and still exist on your system. This is sometimes necessary after installing other packages that may overwrite part of an existing package. When you verify a package, RPM compares information about the installed files in the package with information about the files taken from the original package and stored in the RPM database. Among other things, verifying compares the filename, size, check sum, permissions, type, owner, and group of each file. Any discrepancies in the comparison are displayed on the screen.
To use the verify mode of RPM, use the command with the -w option and the package name. RPM will use one of these eight characters to show a failure of one of the tests:
5 | MD5 sum (checksum) |
S | File size incorrect |
L | Symbolic link incorrect |
T | Time incorrect |
D | Device incorrect |
U | User owner incorrect |
G | Group owner incorrect |
M | Mode incorrect (includes permissions and file types) |
If you find errors in a package, it is usually easiest to reinstall the package.
The installpkg utility is a hold-over from UNIX, where it has been around for years. The installpkg utility can be used to install a package in much the same way as RPM. The command to install the package Xgames would be
installpkg /usr/col/Xgames
By default installpkg looks for packages with .tgz file extensions. If you have a different extension and know that installpkg can handle it, specify the full package name including the extension on the command line. In the case of the above command, the installpkg tool extracts any files in the package /usr/col/Xgames.tgz, unpacking them as it goes.
The directory used by installpkg as the base for its installation is the current one, so in the case of the above example, whatever directory we are in when we issue the installpkg command is where the Xgames package is installed.
Previous | Table of Contents | Next |