This week we are diverging from the usual daily themes to present a Focus Week on Package Management.
This site, the Fedora Daily Package, is all about the software packages included in Fedora Core and Fedora Extras. Fedora includes a number of powerful tools for managing packages, and this week will focus on those tools so that you can get the most out of your system.
The venerable rpm utility provides command-line access to the RPM system. With the development of the Fedora repository system, rpm is rarely used for package installation, update, or removal -- yum serves that role -- but rpm is still the best tool for directly querying the local database of installed software.
The rpm query option (-q) provides access to the RPM database. It is used along with options that fall into two distinct categories: those which select the packages for which information is displayed, and those which select the information to be displayed about each of those packages. Here are the most common options:
Options to select files:
| Option | Selects... |
| packagename | The installed package packagename |
| -a | All installed packages |
| -f filename | The instaled package that provided filename |
| --whatprovides capabilityname | The installed package that provides the capability capabilityname |
| --whatrequires capabilityname | The installed package that depends on the capability capabilityname |
| --triggeredby packagename | All installed packages that include a trigger script which is triggered by the installation or removal of packagename |
| -p filename | The uninstalled package file filename |
Options to control the information displayed:| Option | Displays... |
| (nothing) | The package name and version |
| -l | List of all files in the package |
| -c | List of config files in the package |
| -d | List of documentation files in the package |
| --provides | List of capabilities provided by the package |
| --requires | List of capabilities required by the package (dependencies) |
| -i | Detailed metadata about the packages |
| --scripts | Installation/uninstallation scripts included in the package |
| --triggers | Trigger scripts included in the package |
These arguments can be combined in many different ways. Here are some examples:
To determine if the package bash is installed, and if so, which version:
$ rpm -q bash
bash-3.1-16.1
List the files included in bash:
$ rpm -q -l bash
/bin/bash
/bin/sh
/etc/skel/.bash_logout
/etc/skel/.bash_profile
/etc/skel/.bashrc
/usr/bin/bashbug-32
/usr/share/doc/bash-3.1
/usr/share/doc/bash-3.1/CHANGES
/usr/share/doc/bash-3.1/COMPAT
/usr/share/doc/bash-3.1/FAQ
(snip)
To view only the documentation files:
$ rpm -q -d bash/usr/share/doc/bash-3.1/CHANGES
/usr/share/doc/bash-3.1/COMPAT
/usr/share/doc/bash-3.1/FAQ
/usr/share/doc/bash-3.1/INTRO
/usr/share/doc/bash-3.1/NEWS
/usr/share/doc/bash-3.1/NOTES
/usr/share/doc/bash-3.1/POSIX
/usr/share/doc/bash-3.1/article.ms
/usr/share/doc/bash-3.1/article.ps
/usr/share/doc/bash-3.1/article.txt
(snip)
See just the bash configuration files:
$ rpm -q -c bash/etc/skel/.bash_logout
/etc/skel/.bash_profile
/etc/skel/.bashrc
Detailed metadata about the package that owns the mystery file /usr/bin/text2wave:
$ rpm -qif /usr/bin/text2waveName : festival Relocations: (not relocatable)
Version : 1.95 Vendor: Red Hat, Inc.
Release : 5.2.1 Build Date: Wed 12 Jul 2006 04:46:18 AM EDT
Install Date: Wed 20 Dec 2006 12:22:59 AM EST Build Host: hs20-bc2-3.build.redhat.com
Group : Applications/Multimedia Source RPM: festival-1.95-5.2.1.src.rpm
Size : 51851311 License: X11-style
Signature : DSA/SHA1, Tue 03 Oct 2006 09:18:47 PM EDT, Key ID b44269d04f2a6fd2
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
URL : http://www.cstr.ed.ac.uk/projects/festival/
Summary : A free speech synthesizer
Description :
Festival is a general multi-lingual speech synthesis system developed
at CSTR. It offers a full text to speech system with various APIs, as
well as an environment for development and research of speech synthesis
techniques. It is written in C++ with a Scheme-based command interpreter
To view all of the packages that require perl:
$ rpm -q --whatrequires perldocbook-dtds-1.0-30.1
crypto-utils-2.3-1
automake16-1.6.3-8
automake14-1.4p6-13
automake15-1.5-16
autoconf-2.59-12
autoconf-2.59-12
(snip)
To see which package provides perl capability:
$ rpm -q --whatprovides perlperl-5.8.8-10perl-5.8.8-10
(You're not seeing double -- the package is listed twice).
To determine if the package bash is installed, and if so, which version:
$ rpm -q bashbash-3.1-16.1
To see what files exist in the uninstalled package file ekiga-2.0.2-7.i386.rpm (on a remote server):
$ rpm -qlp http://download.fedora.redhat.com/pub/fedora/linux/core/6/i386/os/Fedora/RPMS/ekiga-2.0.2-7.i386.rpm
/etc/gconf/schemas/ekiga.schemas
/usr/bin/ekiga
/usr/bin/ekiga-config-tool
/usr/lib/bonobo/servers/ekiga.server
/usr/share/applications/gnome-ekiga.desktop
/usr/share/gnome/help/ekiga
/usr/share/gnome/help/ekiga/C
/usr/share/gnome/help/ekiga/C/ekiga.xml
/usr/share/gnome/help/ekiga/C/figures
/usr/share/gnome/help/ekiga/C/figures/accounts_d1.png(snip)
Note that a URL was used instead of a filename.
As you can see, rpm's query facilties are very powerful. The traditional installation, upgrade, and removal capabilities also exist, enabled by the -i, -U, and -e options.
To install a package file: rpm -i packagefile
To update a package file: rpm -U packagefile
To remove an installed pacakge: rpm -e packagefile
Other options are available, including
-h to provide a progress display and
-v to enable verbose output.
However, the best way to install, update, and remove packages on a Fedora system is to use yum -- which is our topic for tomorrow.
Over the next few days we'll continue to examine the Fedora package tools in detail:
- Tuesday - Using the rpm command to query the package database as well as install, update, and remove packages.
- Wednesday - Using yum repository tools, including yum, pirut, pup, yum-updatesd, and yumex.
- Thursday - Enabling and disabling repositories and using yum plugins.
- Friday - Package management tips and tricks.
And in case you missed it: