4. Obtaining your local copy of the distribution

You need a copy of the distribution on a writable disk which is accessible from the computer having the CD writer (duh!). If you want to incorporate the latest updates, this directory should (also) be accessible from a Linux machine, either from a local disk, an NFS mounted disk on a different computer, or a JAZ disk. You could copy the distribution from the RedHat CDs (recommended), or you could get it via FTP. If you choose to use FTP, there are two ways of doing it. You can use the wget based shell script presented in the following section or the mirror package as suggested in versions up to and including 1.34 of the howto (reported in section Using mirror).

4.1. Using wget and bash

This is not the simplest, even if, probably, the most accurate way. I like it because it works comparing the RPM versions of the files and not the dates/times or names (like the standard mirroring packages) and it checks the signatures of the updates each time it downloads some of them if configured to do so by means of the CHECKSIG variable in the rhcd.conf file.

Create a directory to hold the installation files and cd into it, then issue the command (which will download ~3Gb of data on your hard drive):

 
        $ wget -r -c -t0 -l0 --retr-symlinks -nH --cut-dirs=9 \
            ftp://ftp.mirror.ac.uk/sites/ftp.redhat.com/pub/redhat/linux/updates/7.3/en/os/i386
      

You will probably want to change the ftp download mirror and, consequently, the parameter passed to the --cut-dirs option. That's used, in fact, together with -nH to avoid the recreation of the ftp site directory hierarchy. For more information on how to use the option correctly you can have a look at the wget documentation and man page.

If you want to exclude one or more directories from the download, you can use the -X list option, where list represents a comma-separated list of directories. For example to exclude the SRPMS directory from the previous download, you would use:
 
        $ wget -r -c -t0 -l0 --retr-symlinks -nH --cut-dirs=9 \
            -X /sites/ftp.redhat.com/pub/redhat/linux/updates/7.3/en/os/i386/SRPMS \
            ftp://ftp.mirror.ac.uk/sites/ftp.redhat.com/pub/redhat/linux/updates/7.3/en/os/i386
      

This could be useful if you consider the size of the SRPMS directory (~1.2GB), or at least, I find it useful.

If you want to check the GPG signatures to make sure of the authenticity of the packages (which is something I suggest) you should install the gnupg package (needed only on Redhat 7.3) and import the security@redhat.com public key you can find in the root directory of the CDs (RPM-GPG-KEY) or on the RedHat website. The key is imported by running the command: gpg --import <filename> in releases up to and including 7.3, which is to be changed to read rpm --import <filename> for releases 8.0 and 9 (for more informations on this have a look at the GNU Privacy Guard and at the RPM - Redhat Package Manager websites).

If you want to check the rpm packages you can do it using the following command (I'm assuming you are issuing it from the directory you have completed the downloads in):

For releases up to and including 7.3:
 
        $ find . -name "*.rpm" -exec rpm -K --nopgp {} \; |grep "NOT *OK"
      

For release 8.0 and 9 (and for future releases as well I guess):
 
        $ find . -name "*.rpm" -exec rpm -K {} \; |grep "NOT *OK"
      

If you don't want to "bother" yourself with all these steps, I hope you want to check (at least) for the integrity of the downloaded files (which doesn't mean nobody has tampered with them), verifying the md5 signatures. This is done with:

For releases up to and including 7.3:
 
        $ find . -name "*.rpm" -exec rpm -K --nopgp --nogpg {} \; |grep "NOT *OK"
      

For release 8.0 and 9 (and for future releases as well, I guess):
 
        $ find . -name "*.rpm" -exec rpm -K --nosignature {} \; |grep "NOT *OK"
      

The content of a Red Hat distribution does not change between releases, so you only need to download these packages ONCE. All changes to the distribution are in the updates directory. Thus, if you want to keep an up-to-date mirror of the Red Hat distribution, you only need to keep the updates directory current. This is done using the script updateDist.sh. Before using this script you have to configure the rhcd.conf configuration file and export a RHCDPATH variable pointing to the directory where this file is.

        $ export RHCDPATH=/home/luigi/tmp/rhcd-scripts
        $ sh updateDist.sh
      

The script will download the new updates excluding the subdirectories contained in the EXCLUDELIST variable, moving the old ones (i.e. just superseded by new versions) to the directory represented by the OLDDIR variable after having completed two tests. The first test compares the .listing files generated by wget to the content of the local directories to make sure all the files were downloaded. The second test verifies the packages signatures depending on the values of the two variables CHECKSIG and USEGPG (set both of them to "yes" if you want the operation to be completed). In case of a failure in the signature checking process the script will move the offending packages to OLDDIR assigning them the ".UPDcheckfail" extension and exit without moving the old updates to OLDDIR.

4.2. Using mirror

Mirror is a sophisticated perl script that compares the content of a directory on a remote site with a local directory. It will use FTP to fetch the files that are on the remote site but not the local site, and delete files on the local site that are not on the remote site. The mirror program is configured with a configuration file. The mirror package is available as an RPM from rufus.w3.org. Make your local copy mirror.redhat of the mirror configuration file, and edit the relevant fields at the top of the file. After the default section, define these packages:

 
        package=updates
          site=ftp.mirror.ac.uk
          exclude_patt=(SRPMS/)
          remote_dir=/sites/ftp.redhat.com/pub/redhat/linux/updates/7.3/en/os/i386
          local_dir=/home/luigi/tmp/redhat-cd/redhat-7.3-updates

        package=dist
          site=ftp.mirror.ac.uk
          exclude_patt=(SRPMS/)
          remote_dir=/sites/ftp.redhat.com/pub/redhat/linux/7.3/en/os/i386
          local_dir=/home/luigi/tmp/redhat-cd/redhat-7.3
      

The following command will download a copy of the entire RedHat tree on your local disk. **Think** before you do this, you are about to transfer approximately 1.5Gb of data (if you have excluded the SRPMS directory)!

 
        $ mirror -pdist mirror.redhat 
      

This will mirror the Red Hat FTP site on your local disk. The content of a Red Hat distribution does not change between releases, so you only need to download this package ONCE. All changes to the distribution are in the updates directory. Thus, if you want to keep an up-to-date mirror of the Red Hat distribution, you only need to keep the updates directory current. This is done using the command

 
        $ mirror -pupdates mirror.redhat 
      

You can run this regularly, say, once a week, through a cron script. The RedHat distribution is available on a great number of FTP servers around the world, which are updated daily from the master site at ftp.redhat.com. You should choose an FTP site close to you, see the RedHat list of mirror sites.

Note

I haven't personally tested this procedure. It was the only proposed one for the older versions of the howto (up to version 1.34, regarding RedHat <=6.1).