old-www/HOWTO/RedHat-CD-HOWTO/distribution-mirror.html

656 lines
13 KiB
HTML

<HTML
><HEAD
><TITLE
>Obtaining your local copy of the distribution</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE=" Burning a RedHat CD HOWTO
"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="RPM packages"
HREF="rpm-packages.html"><LINK
REL="NEXT"
TITLE="Including the updates"
HREF="include-updates.html"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Burning a RedHat CD HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="rpm-packages.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="include-updates.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="DISTRIBUTION-MIRROR"
></A
>4. Obtaining your local copy of the distribution</H1
><P
> 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 <EM
>wget</EM
> based shell script
presented in the following section or the <EM
>mirror</EM
>
package as suggested in versions up to and including 1.34 of the howto
(reported in section <A
HREF="distribution-mirror.html#USING-MIRROR"
>Using mirror</A
>).
</P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="USING-WGET-BASH"
></A
>4.1. Using wget and bash</H2
><P
>
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
<EM
>CHECKSIG</EM
> variable in the
<A
HREF="rhcd-scripts/rhcd.conf"
TARGET="_top"
>rhcd.conf</A
> file.
</P
><P
> Create a directory to hold the installation files and <EM
>cd</EM
>
into it, then issue the command (which will download ~3Gb of data on your
hard drive):
</P
><P
> <TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>
$ 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
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> You will probably want to change the ftp download mirror and, consequently, the
parameter passed to the <EM
>--cut-dirs</EM
> option. That's used,
in fact, together with <EM
>-nH</EM
> 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 <A
HREF="http://www.gnu.org/manual/wget-1.8.1/wget.html"
TARGET="_top"
> wget documentation</A
> and man page.
</P
><P
> If you want to exclude one or more directories from the download, you can use the
<EM
>-X list</EM
> option, where <EM
>list</EM
> represents
a comma-separated list of directories. For example to exclude the
<TT
CLASS="FILENAME"
>SRPMS</TT
> directory from the previous download, you would use:
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>
$ 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
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> This could be useful if you consider the size of the <TT
CLASS="FILENAME"
>SRPMS</TT
>
directory (~1.2GB), or at least, I find it useful.
</P
><P
> 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
<EM
>gnupg</EM
> package (needed only on Redhat 7.3) and import the
<EM
>security@redhat.com</EM
> public key you can find in the root
directory of the CDs (<TT
CLASS="FILENAME"
>RPM-GPG-KEY</TT
>) or on the
<A
HREF="http://www.redhat.com/solutions/security/news/publickey.html#key"
TARGET="_top"
>RedHat
website</A
>. The key is imported by running the command:
<EM
>gpg --import &#60;filename&#62; </EM
> in releases up to and including
7.3, which is to be changed to read <EM
>rpm --import &#60;filename&#62; </EM
>
for releases 8.0 and 9 (for more informations on this have a look at the
<A
HREF="http://www.gnupg.org/"
TARGET="_top"
>GNU Privacy Guard</A
> and at the
<A
HREF="http://www.rpm.org/"
TARGET="_top"
>RPM</A
> - Redhat Package Manager websites).
</P
><P
> 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):
</P
><P
> For releases up to and including 7.3:
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>
$ find . -name "*.rpm" -exec rpm -K --nopgp {} \; |grep "NOT *OK"
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> For release 8.0 and 9 (and for future releases as well I guess):
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>
$ find . -name "*.rpm" -exec rpm -K {} \; |grep "NOT *OK"
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> If you don't want to <SPAN
CLASS="QUOTE"
>"bother"</SPAN
> 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:
</P
><P
> For releases up to and including 7.3:
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>
$ find . -name "*.rpm" -exec rpm -K --nopgp --nogpg {} \; |grep "NOT *OK"
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> For release 8.0 and 9 (and for future releases as well, I guess):
<TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>
$ find . -name "*.rpm" -exec rpm -K --nosignature {} \; |grep "NOT *OK"
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> The content of a Red Hat distribution does not change between releases, so
you only need to download these packages <EM
>ONCE</EM
>. All changes
to the distribution are in the <TT
CLASS="FILENAME"
>updates</TT
>
directory. Thus, if you want to keep an up-to-date mirror of the Red Hat
distribution, you only need to keep the
<TT
CLASS="FILENAME"
>updates</TT
> directory current. This is
done using the script
<A
HREF="rhcd-scripts/updateDist.sh"
TARGET="_top"
> updateDist.sh</A
>. Before using this script you have to configure the
<A
HREF="rhcd-scripts/rhcd.conf"
TARGET="_top"
> rhcd.conf</A
> configuration file and export a <EM
>RHCDPATH</EM
>
variable pointing to the directory where this file is.
</P
><P
> <TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
> $ export RHCDPATH=/home/luigi/tmp/rhcd-scripts
$ sh updateDist.sh
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> The script will download the new updates excluding the subdirectories contained in
the <EM
>EXCLUDELIST</EM
> variable, moving the old ones (i.e. just
superseded by new versions) to the directory represented by the
<EM
>OLDDIR</EM
> variable after having completed two tests.
The first test compares the <TT
CLASS="FILENAME"
>.listing</TT
> files generated by
<TT
CLASS="FILENAME"
>wget</TT
> 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 <EM
>CHECKSIG</EM
> and <EM
>USEGPG</EM
> (set both
of them to <SPAN
CLASS="QUOTE"
>"yes"</SPAN
> 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 <EM
>OLDDIR</EM
> assigning them the
<SPAN
CLASS="QUOTE"
>".UPDcheckfail"</SPAN
> extension and exit without moving the old updates to
<EM
>OLDDIR</EM
>.
</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="USING-MIRROR"
></A
>4.2. Using mirror</H2
><P
> 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 <A
HREF="http://rufus.w3.org/linux/RPM/mirror.html"
TARGET="_top"
> rufus.w3.org</A
>. Make your local copy <TT
CLASS="FILENAME"
>mirror.redhat</TT
>
of the mirror configuration file, and edit the relevant fields at the top of
the file. After the default section, define these packages:
</P
><P
> <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>
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
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> The following command will download a copy of the entire RedHat tree on
your local disk. <EM
>**Think**</EM
> before you do this, you
are about to transfer approximately 1.5Gb of data (if you have excluded the
<TT
CLASS="FILENAME"
>SRPMS</TT
> directory)!
</P
><P
> <TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>
$ mirror -pdist mirror.redhat
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> 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 <EM
>ONCE</EM
>. All changes to the
distribution are in the <TT
CLASS="FILENAME"
>updates</TT
>
directory. Thus, if you want to keep an up-to-date mirror of the Red Hat
distribution, you only need to keep the <TT
CLASS="FILENAME"
>updates
</TT
> directory current. This is done using the command
</P
><P
> <TABLE
BORDER="1"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="SCREEN"
>
$ mirror -pupdates mirror.redhat
</PRE
></FONT
></TD
></TR
></TABLE
>
</P
><P
> 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
<A
HREF="ftp://ftp.redhat.com/pub"
TARGET="_top"
>ftp.redhat.com</A
>. You should
choose an FTP site close to you, see the
<A
HREF="http://www.redhat.com/download/mirror.html"
TARGET="_top"
> RedHat list of mirror sites</A
>.
</P
><DIV
CLASS="NOTE"
><P
></P
><TABLE
CLASS="NOTE"
WIDTH="100%"
BORDER="0"
><TR
><TD
WIDTH="25"
ALIGN="CENTER"
VALIGN="TOP"
><IMG
SRC="../images/note.gif"
HSPACE="5"
ALT="Note"></TD
><TD
ALIGN="LEFT"
VALIGN="TOP"
><P
> 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 &#60;=6.1).
</P
></TD
></TR
></TABLE
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="rpm-packages.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="include-updates.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>RPM packages</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Including the updates</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>