Section 7.1. Getting the Packages


7.1. Getting the Packages

You already have many of the packages that you'll want in a yum repository: the same RPMs that are already included with the installation CDs/DVDs for your distribution. With those RPMs, you can use yum to populate the base repository and add the headers needed for easy access from the other computers on your network.

In this part of the chapter, we'll show you how to start your repository, install yum, create an appropriate yum directory tree, add headers to the appropriate directory, and test the base repository on your local system. We'll start with the Fedora Core 4 Updates repository. When you see how it's done, you can use the same techniques to create other repositories on your system.

While you could use the rsync command described in earlier chapters to mirror an entire repository, each version of Fedora requires well over 10GB of space. You do not need to mirror the directory with the 6GB+ of ISO files. As described earlier in this book, there are ways to cut that down with appropriate --exclude switches to the rsync command. But if the loads on your Internet connection are not a problem, you might not need a local patch management repository in the first place.

Note

SUSE supports two different patch management tools described in Chapter 3, "SUSE's Update Systems and rsync Mirrors": YaST Online Update and Zenworks Linux Management. As noted in Chapters 5 and 6, they now support apt, and plan to support yum in the future.


7.1.1. Strategy

Before you create your repository, decide what you want to store locally. Viable options vary. If you have only two or three workstations, a local repository might not be so important. However, it can become profitable to configure a local repository if you have a substantial number of workstations. What you configure locally depends on your patch management strategy. Consider the following:

To keep a substantial number of computers up to date, it can help to configure a local repository for updates. Alternatively, if your Internet bandwidth is unlimited, and the people behind your remote mirror do not object to the load, you may prefer to use remote mirrors, as they may be more up to date.

If you frequently change the base software on your systems, you should load the installation RPMs on your repository.

If you need packages outside the standards available on the installation CDs, look for other directories of RPMs on your favorite mirror. For example, Fedora includes the Extras repository with many useful packages.

If you need packages simply unavailable from mirrors associated with your distribution, there are also third-party repositories described throughout this book.

If your users test updates before they're moved to the stable update repository, consider mirroring such repositories. You may even have reason to mirror a development repository. However, be warned that these packages are generally not stable or suitable for a production environment.

Note

The Fedora development repositories, formerly known as "Rawhide," are collections of RPMs that may change on a day-to-day basis. They are, by definition, not stable. They are not suitable for production use. However, they may be of considerable interest to developers and others looking for the latest available solutions.


After you decide what you're going to mirror, you can set up a yum directory tree for your local repository. In the following sections, we'll focus on creating an Updates repository. If you have the installation CD available, you can use the same steps to create an Installation repository.

In my case, I've created a Fedora Core 4 repository on a system running RHEL 4, as it is a fairly stable distribution. You'll want to leave room for future releases of Fedora Core. It might even make sense to add a new hard drive for that purpose so that the packages won't overwhelm other files on your system. In any case, it's an excellent idea to at least configure a separate partition for your repository.

7.1.2. Creating a yum Directory Tree

We're assuming that you're ready to create your own yum repository directory tree for your own network and that the tree does not have to be identical to the one on your favorite mirror. For example, assume that you've created the /var/ftp/pub/yum directory in a separate partition. Assume that for now, all you need to provide for are standard 32-bit systems. If you wanted to create a yum directory tree for Fedora Core 4, you might end up with the following directories:

/var/ftp/pub/yum/4/i386/os /var/ftp/pub/yum/4/i386/updates /var/ftp/pub/yum/4/i386/extras /var/ftp/pub/yum/4/i386/dag 


The /var/ftp/pub directory is the default directory associated with the vsFTP server. It happens to be the default FTP server for Fedora and Red Hat distributions. With the right settings, you can link to this directory from an Apache Web server. You can also share this directory on the local network using NFS. In fact, NFS is generally preferred on a network of Linux computers because shared NFS directories can be treated as if they were on the local computer.

Note

To promote security, the vsFTP server does not allow symbolic links (also known as symlinks). Therefore, you can't use the vsFTP server for packages downloaded to directories, such as /var/spool/up2date.


As the noted directories are several levels below /var/ftp/pub, you might feel like you'll have to run the mkdir command a thousand times. There is one minor trick that can speed the process. The following command creates all needed subdirectories in one shot:

mkdir -p /var/ftp/pub/yum/4/i386/os 


Note that the structure of these directories does not correspond to those you see in current Fedora Core mirrors. The directory structure of different Fedora Core mirrors varies. Unless you're creating a mirror for public use, there is no need to create a directory structure similar to any existing Fedora Core mirror.

7.1.3. Start with a Distribution

For the purpose of this chapter, I've downloaded the Fedora Core 4 installation DVD, to create repositories for Fedora Core 4 systems. As noted earlier, it'll be on a RHEL 4 computer so that I can add repositories for future releases of Fedora Core. As RHEL 4 was developed in large part from Fedora Core 3, I'll be using Fedora-based yum packages. Naturally, the following instructions will also work for a repository configured on Fedora Core 3.

Note

For Fedora Core 3, this section works in the same way. Just substitute appropriate file names. I could not test these settings on Fedora Core 5, as Red Hat was just starting its test (beta) releases for this distribution as this book was going to print.


For example, if you've download the Fedora Core DVD, you can mount the ISO file almost as if it were a DVD/CD with the following command:

mount -o loop FC4-i386-DVD.iso /media/cdrecorder 


Of course, you can "burn" the DVD .iso file (or associated CD .iso files) to appropriate media. It may be handy to have a DVD available. But, in my opinion, because you can mount the ISO directly, you don't need a physical DVD.

Note

If you can't work with DVD-sized files, you can still create a local repository. For example, if you've downloaded the four Fedora Core 4 binary CDs, all you need to do is mount the CDs one at a time, and copy their contents (including the .discinfo file from the first CD) to the directory of your choice. For example, you could run the following commands:

mount -o loop FC4-i386-disc1.iso /media/cdrecorder cp -ar /media/cdrecorder/* \ /var/ftp/pub/yum/4/i386/os/ 


If it's the first CD, don't forget to copy the .discinfo file to the noted directory. Change CDs:

mount -o loop FC4-i386-disc2.iso /media/cdrecorder cp -ar /media/cdrecorder/* \ /var/ftp/pub/yum/4/i386/os/ 


Repeat the process until you've reached the fourth CD.


A quick look at other mirrors confirms that the contents of the Fedora Core DVD are part of the os/ repository directory. You can make it part of your own local repository, by copying the contents of the DVD to the corresponding directory described earlier:

cp -ar /media/cdrecorder/* /var/ftp/pub/yum/4/i386/os/ 


7.1.4. Installing yum

For Fedora Core 3 and above, you'll need at least the yum and createrepo RPMs, along with the packages associated with the way you plan to share your repository on your network (FTP, Apache, or NFS server). Earlier versions of Fedora Core did not include a createrepo RPM; if you want to create a repository from Fedora Core 1 or 2, use the yum-arch command, which is part of the yum RPM and is functionally similar to createrepo.

When the appropriate CD or DVD is mounted, you can then install the Fedora Core 3 yum and createrepo RPMs with the following commands:

rpm -Uvh /media/cdrecorder/Fedora/RPMS/yum* rpm -Uvh /media/cdrecorder/Fedora/RPMS/createrepo* 


Note

Because RHEL 4 is built on Fedora Core 3, it generally works when you use Fedora Core 3 RPMs on RHEL 4. However, Fedora Core 4 RPMs sometimes require more advanced dependent packages. If you install those dependencies, that might cause problems for other RHEL 4 applications.


If you're working with a RHEL 4 rebuild distribution, such as CentOS-4, the appropriate yum packages may already be installed on your system. The actual directory with these packages may vary; for example, the CentOS-4 version of the createrepo RPM is part of the CentOS-4 addons/ repository directory.

Note

If you are also using this server for installations, copy the .iso files associated with the DVD or CDs to the /var/ftp/pub directory. The Red Hat installation program, Anaconda, can automatically mount and read appropriate .iso files. When shared, you can use this directory as a network installation source, which can help you automate the installation of additional PCs.


If you're working with RHEL 4, you can install the yum and createrepo RPMs from Fedora Core 3. If you don't have the associated installation media, you can download the RPMs directly from your favorite mirror from among those listed at http://fedora.redhat.com/download/mirrors.html.

7.1.5. Synchronizing Updates

More important than the installation RPMs are the updates. While you can use tools, such as system-config-packages, to install and remove Fedora packages from the installation files, you need access to the updates to manage patches on your system. Based on the directories described earlier, we're planning to store RPMs from the Fedora Core 4 Updates repository on the following directory:

/var/ftp/pub/yum/4/i386/updates 


Based on the rsync commands described in Chapter 2, you should find an Updates repository in the rsync mirror of your choice. Fedora rsync mirrors are listed at http://fedora.redhat.com/download/mirrors.html. One rsync mirror that I use is rsync://mirrors.kernel.org/fedora/core.

You can list the directories and files on a remote rsync server. Just make sure to include the last forward slash in your command. For example, the following command lists the directories available in the Kernel.org Fedora Core repository:

rsync rsync://mirrors.kernel.org/fedora/core/ 


You'll see updates/ in the directory tree. As you continue this process, you'll find the actual updates/ RPMs in the updates/4/i386/ subdirectory.

Search through the subdirectory. You'll find debug/ and repodata/ subdirectories. While you may be able to use the data in the repodata/ subdirectory in your own yum repository, you don't need to download the hundreds of megabytes of files in the debug/ subdirectory. To avoid downloading files from that directory, you'll need to apply the --exclude switch. For example, the following rsync command synchronizes the packages from the remote updates/ repository, without debug/ packages:

Note

Through Fedora Core 3, the noted repository included a headers/ subdirectory, as created with the yum-arch command.


rsync -av --exclude debug \ rsync://mirrors.kernel.org/fedora/core/updates/4/i386/* \ /var/ftp/pub/yum/4/i386/updates/ 


As noted in Chapter 3, this synchronizes the noted remote and local directories in (-a) archive mode, with (-v) verbose output. Contents from the debug directory are (--exclude) excluded.

Note

Note the backslashes (\) at the end of the first two parts of the command line. It's an escape character, which cancels out the carriage return; in other words, all three lines are run as a single command.




Linux(r) Patch Management(c) Keeping Linux(r) Systems Up To Date
Linux Patch Management: Keeping Linux Systems Up To Date
ISBN: 0132366754
EAN: 2147483647
Year: 2006
Pages: 80
Authors: Michael Jang

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net