- Table of Contents
- Copyright
- About the Lead Authors
- About the Contributing Authors
- Acknowledgments
- Tell Us What You Think!
- Introduction
- I. Red Hat Linux Installation and User Services
- Chapter 1. Introduction to Red Hat Linux
- Chapter 2. Installation of Your Red Hat System
- Chapter 3. LILO and Other Boot Managers
- Chapter 4. Configuring the X Window System, Version 11
- Chapter 5. Window Managers
- Chapter 6. Connecting to the Internet
- Chapter 7. IRC, ICQ, and Chat Clients
- Chapter 8. Using Multimedia and Graphics Clients
- II. Configuring Services
- Chapter 9. System Startup and Shutdown
- Chapter 10. SMTP and Protocols
- Chapter 11. FTP
- Chapter 12. Apache Server
- Chapter 13. Internet News
- Chapter 14. Domain Name Service and Dynamic Host Configuration Protocol
- Chapter 15. NIS: Network Information Service
- Chapter 16. NFS: Network Filesystem
- Chapter 17. Samba
- III. System Administration and Management
- Chapter 18. Linux Filesystems, Disks, and Other Devices
- Chapter 19. Printing with Linux
- Chapter 20. TCP/IP Network Management
- Chapter 21. Linux System Administration
- Working as root
- Performing System Maintenance
- Managing Software with RPM
- Using Gnome-RPM
- Managing Users and Groups with linuxconf
- Managing Users and Groups from the Command Line
- Setting Disk Quotas with linuxconf
- Creating Special Accounts with linuxconf
- Analyzing Performance
- Understanding Your Security Responsibilities
- Getting Help
- Summary
- Chapter 22. Backup and Restore
- Chapter 23. System Security
- IV. Red Hat Development and Productivity
- Chapter 24. Linux C/C++ Programming Tools
- Chapter 25. Shell Scripting
- Chapter 26. Automating Tasks
- Chapter 27. Configuring and Building Kernels
- Chapter 28. Emulators, Tools, and Window Clients
- V. Appendixes
- A. The Linux Documentation Project
- B. Top Linux Commands and Utilities
- C. The GNU General Public License
- D. Red Hat Linux RPM Package Listings
Managing Software with RPM
Years ago, installing software on your Linux box meant untarring a file in your root system directory (/). Keeping track of what was where and trying to uninstall it was a mess, not to mention even knowing what version of the software you had.
I once removed an old library because I thought it wasn't in use anymore and I needed the disk space. After I deleted the file, half the commands on my system stopped working! Turns out there were dependencies on that library that I didn't know about.
Linux has grown to be much more sophisticated. Now it has package management tools that help you maintain a database of installed software and their files, which allows you to perform powerful queries and verification of your system.
One such tool is the Red Hat Package Manager, which is most commonly referred to as RPM. Some other distributions have their own package management tool, such as debian, but RPM is quickly becoming the standard for many distributions.
Installing
One of the most common tasks that you will use RPM for is installing new software packages. RPM packages typically are in one file having a name such as banana-1.0-1.i386.rpm, which includes the package name (banana), version (1.0), release (1), and architecture (i386). If you mount your Red Hat Linux CD-ROM and look under the directory Redhat/RPMS, you will see the hundreds of software packages that make up the Red Hat Linux distribution.
The typical command to install a package is
[root@cartoons]# rpm -ivh banana-1.0-1.i386.rpm
One of the more complex commands allows you to install packages via FTP rather than a CD-ROM or local disk:
[root@cartoons]# rpm -i ftp://ftp.redhat.com/pub/RPMS/banana-1.0-1.i386.rpm
RPM packages can "depend" on other packages, which means that they require other packages to be installed in order to run properly. If you try to install a package for which there is such an unresolved dependency, you'll see
[root@cartoons]# rpm -ivh boat-1.0-1.i386.rpm
failed dependencies:
banana is needed by boat-1.0-1
[root@cartoons]#
To resolve failed dependencies, install the requested packages. If you want to force the installation anyway (a bad idea since the package probably will not run correctly), use the -nodeps option.
Uninstalling
After you have been using your Red Hat Linux system for a period of time, you may decide to remove a package because you never use it or you need to free up some disk space. RPM makes it easy, doing all the hard work for you.
Uninstalling a package is just as simple as installing. You use the following command:
[root@cartoons]# rpm -e banana
Notice that we used the package name "banana," rather than the name of the original package file banana-1.0-1.i386.rpm.
You can encounter a dependency error when uninstalling a package if some other installed package depends on the one that you are trying to remove. For example:
[root@cartoons]# rpm -e banana
removing these packages would break dependencies:
banana is needed by boat-1.0-1
[root@cartoons]#
You can force RPM to ignore these dependencies by using the -nodeps option, but this option is not recommended because it can leave your system in an unstable state.
Upgrading
Upgrading a package is similar to installing one. The upgrade command is
[root@cartoons]# rpm -Uvh banana-2.0-1.i386.rpm banana ################################### [root@cartoons]#
What you don't see on the preceding command is that RPM automatically uninstalled old versions of the banana package. In fact, you may want to always use -U to install packages because it works fine even when there are no previous versions of the package installed. Because RPM performs intelligent upgrading of packages with configuration files, you may see a message such as saving /etc/banana.conf as /etc/banana.conf.rpmsave. This means that during the upgrade, RPM considered your changes to the existing file to be potentially incompatible with the new configuration file in the new package. RPM saved your original configuration file and installed a new one. You should investigate and resolve the differences between the two files as soon as possible to ensure that your system continues to function properly.
Because upgrading is really a combination of uninstalling and installing, you can encounter regular errors from those modes, plus one additional error: If RPM thinks you are trying to upgrade to a package with an older version number, you will see
[root@cartoons]# rpm -Uvh banana-1.0-1.i386.rpm banana package banana-2.0-1 (which is newer) is already installed error: banana-1.0-1.i386.rpm cannot be installed [root@cartoons]#
To cause RPM to upgrade anyway, include --oldpackage in the upgrade command:
[root@cartoons]# rpm -Uvh --oldpackage banana-1.0-1.i386.rpm banana #################################### [root@cartoons]#
Querying
You can query the database to find installed packages by using the rpm –q command. A simple use is rpm -q banana, which will print the package name, version, and release number of the installed package banana. For example:
[scooby@cartoons]$ rpm -q banana banana-2.0-1 [scooby@cartoons]$
Package Specification Options
Instead of specifying the package name, you can use the Package Specification Options with -q to specify the package(s) that you want to query. These options include the following:
- -a—Queries all currently installed packages.
- -f <file>—Queries the package owning the specified file.
- -p <packagefile>—Queries the specified package filename.
Information Options
You can specify what information to display about queried packages. The following options are used to select the type of information for which you are searching:
- -i displays package information such as name, description, release, size, build date, install date, vendor, and other miscellaneous information.
- -l displays the list of files that the package "owns."
- -s displays the state of all the files in the package.
- -d displays a list of files marked as documentation (man pages, info pages, READMEs, and so on).
- -c displays a list of files marked as configuration files. These are the files that you change after installation to adapt the package to your system (sendmail.cf, passwd, inittab, and so on).
For those options that display file lists, you can add -v to the query command to view the list in the familiar ls -l format.
Here's an example of doing a more sophisticated query:
[scooby@cartoons]$ rpm -qi kernel Name : kernel Relocations: (not relocateable) Version : 2.2.16 Vendor: Red Hat, Inc. Release : 5.0 Build Date: Wed 26 Jul 2000 09:13:08 PM EST Install date: Sat 05 Apr 2000 08:44:13 AM EDT Build Host: porky.redhat.com Group : System Environment/Kernel Source RPM: kernel-2.2.16-17.src.rpm Size : 15122940 License: GPL Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla> Summary : The Linux kernel (the core of the Linux operating system). Description : The kernel package contains the Linux kernel (vmlinuz), the core of your Red Hat Linux operating system. The kernel handles the basic functions of the operating system: memory allocation, process allocation, device input and output, etc.
For more details about using RPM, check out [scooby@cartoons]$ man rpm.
Using Gnome-RPM | Next Section

Account Sign In
View your cart