3. RPM packages

The major part of the Red Hat distribution consists of a set of RPM (Redhat Package Manager) files. An RPM package typically contains binary executables, along with relevant configuration files and documentation. The rpm program is a powerful package manager, which can be used to install, query, verify, update, erase and build software packages in the RPM format. Rpm convieniently maintains a database of all the software packages it has installed, so information on the installed software is available at any time.

The binary RPM files in the distribution have been built on a system running the distribution itself. This is important, because most of the programs in the packages rely on shared libraries. From RedHat version 5.0, the new version 2 of the GNU standard C library (which is 64-bit clean) has been used. This version of the library is commonly referred to as glibc or in Linux: libc 6. All executables in the distribution have been linked against this library. If you attempt to install binary files from a different distribution, chances are that they will not work, unless you install the libc5 package for backwards compability. There are also incompatibilities between the various version of the Redhat Package Manager itself which will make the installation of some packages fail even on machines they are supposed to (and they would probably) run on.

The names of the RPM packages contain the suffix .arch.rpm, where arch is the architecture, usually having the value i386 for Intel platform binaries. The packages you install must match the versions of the shared libraries available on the machine. The rpm program is usually quite good at ensuring that this is indeed the case, however, there are ways around this check, and you should be sure that you know what you are doing if you force installation of packages this way. However, using the RedHat installation boot disk, it is ensured that the correct set of RPM packages are installed on the machine.

If you discover a RPM package that was not installed on your system during the installation process, don't despair. At any time, you may (as root) install RPM packages, for example:
      # rpm --install  WindowMaker-0.18-1b.i386.rpm
    

You can even install directly from the Internet, if you know the URL of a RPM package:
      # rpm --install ftp://rufus.w3.org/redhat-contrib/noarch/mirror-2.9-2.noarch.rpm
    

If you want to update (or install if it's not present on the machine) a RPM package, use the command:
      # rpm --update  WindowMaker-0.18-1b.i386.rpm
    

If you want to update a RPM package only if a previous version is already installed on the machine use the command:
      # rpm --freshen  WindowMaker-0.18-1b.i386.rpm
    

Another version of the RPM packages contains the original sources used to build the binaries. These packages have the suffix .src.rpm and are situated in the SRPMS directory. These packages compose the last two CDs and part of the third one out of the five which compose the 8.0 (or 7.3) release. For release 9 they are on three separate CDs. For 6.2 (and previous, not too old, versions), things change a bit because there is only one installation CD not comprising the SRPMS packages, which you can burn on a different disc, if you want.

To obtain more informations on the Redhat package manager, I suggest you to read the man pages and the fairly detailed book maximum rpm.

In the next section, I will introduce a C program which will be used in various scripts throughout the rest of the howto. It just returns, given two versions of the same RPM package, which one is newer. This program is based on the code used in the Redhat Package Manager (release 4.1) and is used when the --freshen option is given.

3.1. Comparing two versions of a RPM package

The C code included in the three files Makefile, rvc.h, rvc.c was extracted from the Redhat Package Manager and (slightly) modified to fit our needs. They form a simple C program which given two versions A and B of a package returns 1, 0 or -1 if A is respectively newer, equal or older than B and other values in case of error (you can read the code comments for more detailed informations). To compile the program (you need the make program and the gcc C compiler), put the files in the same directory and issue the command:
        $ make
      

This program is needed by almost every script used in the following sections and is found setting the RVC variable in the file rhcd.conf.

You can find a copy of the source and a precompiled version in the archive rhcd-sripts.tar.gz in the rpmvc directory.

Note

There was an error in the way this program was used by the updateDist.sh (ver. < 1.17) and updateCD.sh (ver. < 1.12) scripts. I strongly suggest to avoid versions of the scripts which have lower release numbers than the reported ones, even if the problem doesn't show up really frequently (at least apparently).