Installing packages
Now we have a handle on RPM files, we can start adding them to our system. We now drop the--queryoption and replace it with the--installoption.
While all the queries we have done to date could have been done by any user, installations must be done by the superuser.
As is typically the case on Unix systems, successful operation is completely silent, as shown on slide 66. The package has been installed. Try it; it’s very silly.
# rpm --install xsnow-1.42-10.i386.rpm #
Slide 66: Installing a package
BUG WARNING AND WORKAROUND
There is an intermittent bug in the current versions ofrpmwhich causes it to lock up under certain circumstances. Because it is intermittent it is very hard to pin down and fix. As a result, Red Hat have no patch for it yet. The symptoms are that commands which update the package database hang. Control-C does not kill them and nor does
kill -TERM. This paragraph gives the workaround.
1. Identify therpmprocess 2. Kill it
3. Change to the/var/lib/rpmdirectory 4. Rundb recover -c
# ps -ef | grep rpm
root 3853 3717 3 14:26 pts/0 00:00:00 rpm --install xsnow-1.42-10.i386.rpm root 3855 3717 0 14:26 pts/0 00:00:00 grep rpm
# kill -KILL 3853 # cd /var/lib/rpm # db recover -c
Package dependencies
Now we’ll examine a failed attempt to install a package. Suppose we want to install the DVI previewing program (“xdvi”). This comes in a packagetetex-xdvi-1.0.7-66.
However, an attempt to install it fails with a huge “failed dependencies” error (slide 67). The first line is thae statement of an explicit package-on-package dependency. To use thetetex-xdvipackage at version1.0.7you must have thetetex-fontspackage at the same version. This is followed by a long list of shared libraries the package needs. One of the features of the Red Hat package management system is that when executable binaries are packaged up the packaging program determines what libraries those programs need. If the libraries aren’t in the package itself it records their names as “dependencies”. If the dependencies aren’t satisfied (i.e. if the libraries aren’t present) then the package won’t be installed.
It is possible to overriderpmby crushing its objections underfoot. There is a--nodepssuboption which means “ignore the dependency problems”. We’re not going to use this until later. In the mean time we will resolve the dependencies.
# rpm --query tetex-xdvi
package tetex-xdvi is not installed
# rpm --install tetex-xdvi-1.0.7-66.i386.rpm error: failed dependencies:
libmd5.so.0 is needed by tetex-xdvi-1.0.7-66 libwwwapp.so.0 is needed by tetex-xdvi-1.0.7-66 libwwwcache.so.0 is needed by tetex-xdvi-1.0.7-66 ...
tetex-fonts = 1.0.7 is needed by tetex-xdvi-1.0.7-66 # rpm --query tetex-xdvi
package tetex-xdvi is not installed
Slide 67: Failing to installtetex-xdvi-1.0.7-66
Looking for the libraries manually
Packages containing libraries are often named after their principal library, so we look for these names in the set of package files (slide 68).
Of these, the package filew3c-libwww-5.4.0-4.i386.rpm looks most promising so we examine the list of its contents (slide 69). We find that it actually contains all the libraries thetetex-xdvipackage needs. This is not uncommon; if a set of libraries are typically used together it’s sensible to combine them in a single package. The real question is why the libraries aren’t in the program’s package. The reason is that other programs could use these libraries. For example, all the programs in the package filew3c-libwww-apps-5.4.0-4.i386.rpmuse them too.
# ls *libwww*
perl-libwww-perl-5.65-6.noarch.rpm w3c-libwww-5.4.0-4.i386.rpm
w3c-libwww-apps-5.4.0-4.i386.rpm w3c-libwww-devel-5.4.0-4.i386.rpm
# rpm --query --list --package w3c-libwww-5.4.0-4.i386.rpm /usr/lib/libmd5.so.0 /usr/lib/libmd5.so.0.1.0 /usr/lib/libwwwapp.so.0 /usr/lib/libwwwapp.so.0.1.0 /usr/lib/libwwwcache.so.0 /usr/lib/libwwwcache.so.0.1.0 ...
Slide 69: Finding thelibwwwlibraries
rpmdb-redhat
A copy of the RPM database for all packages from the Red Hat Linux distribution Letsrpmknow about uninstalled packages from Red Hat Linux
Causes therpmto offer suggested resolutions to dependencies
# rpm --install rpmdb-redhat-9-0.20030313.i386.rpm
Slide 70: The RPM database package
The RPM database package
Searching manually is a bit hit-and-miss and there is a better way. Red Hat ship a database of all their packages and what they contain. This allows therpmsystem to recommend other uninstalled packages to resolve dependencies. Note that this will only work for packages from Red Hat. Third party packages will not benefit from this.
# rpm --query tetex-xdvi
package tetex-xdvi is not installed
# rpm --install tetex-xdvi-1.0.7-66.i386.rpm error: failed dependencies:
libmd5.so.0 is needed by tetex-xdvi-1.0.7-66 libwwwapp.so.0 is needed by tetex-xdvi-1.0.7-66 libwwwcache.so.0 is needed by tetex-xdvi-1.0.7-66 ...
tetex-fonts = 1.0.7 is needed by tetex-xdvi-1.0.7-66 Suggested resolutions:
tetex-fonts-1.0.7-66.i386.rpm w3c-libwww-5.4.0-4.i386.rpm # rpm --query tetex-xdvi
package tetex-xdvi is not installed
Slide 71: Failing to installtetex-xdvi-1.0.7-66again
Successful installation
Now we need to resolve the dependency. We could, if we wanted to, first install thetetex-fontsandw3c-libwww
however, we don’t need to do this, and a more typical use is to install all three packages at once. Note that it does not matter in what order the package files appear on the command line.
# rpm --query tetex-xdvi
package tetex-xdvi is not installed
# rpm --install tetex-xdvi-1.0.7-66.i386.rpm \
tetex-fonts-1.0.7-66.i386.rpm w3c-libwww-5.4.0-4.i386.rpm # rpm --query tetex-xdvi
tetex-xdvi-1.0.7-66
Slide 72: Successful installation oftetex-xdvi-1.0.7-66