Section 2.1. Creating Your Own Fedora Repository


2.1. Creating Your Own Fedora Repository

In this section, you'll learn the basic process for creating a Fedora repository. It relies on the yum commands, so you'll learn the details in Chapter 7. For the most part, this section is a high-level overview; it can help you contrast the requirements for patch management for networks based on Fedora, RHEL, and RHEL rebuild distributions.

If you're configuring a repository, it's normally best if you create a dedicated partition for that repository. This section assumes that you've installed a new hard drive for this purpose and details the steps that you would take to create a dedicated partition.

2.1.1. Installation Requirements

Unlike with the Red Hat Network Proxy Server, there are no specific hardware requirements for a Fedora repository. Software requirements are fairly minimal. But the demands on a Fedora-based patch repository are the same. Other Fedora computers on your network will pull updates from your local repository on a regular basis. Therefore, on a Fedora-based patch repository, you should consider the following:

Hardware

An ideal Fedora repository computer should meet the requirements associated with a Red Hat Network Proxy Server, as described in Chapter 1. To review, while CPU speed is less important, you should have a computer with the following:

Fast hard drive access; because any local cache of patches fills gigabytes of space, you'll want a computer that can pull those updates quickly.

Fastest possible network connections; if dozens of computers download updates from your repository simultaneously, they need to share bandwidth on your LAN.

Extra RAM cache updates, which can help minimize the requirements on the hard drive(s).

Hard Drive Partitions

When you configure Fedora as a patch management computer, it is best to set up a dedicated partition for the purpose. In this way, other programs that you might install and other services with ever-growing log files won't crowd out your repositories (or vise versa).

Normally, patches are downloaded to the /var directory. Red Hat, Fedora, Debian, and SUSE all follow this convention. Red Hat and Fedora patch RPMs are normally downloaded to /var/spool/up2date and then deleted after the RPMs are used to update your system. As you learned in Chapter 1, Fedora clients are configured through files such as /etc/yum.conf or in the /etc/yum.repos.d directory to pull updates from FTP or HTTP servers.

Therefore, most administrators create Fedora repositories on a local FTP or HTTP server. The default directories for associated files are /var/ftp/pub and /var/www/html. If you want to protect the space assigned to your repositories, you'll want to dedicate a partition for this purpose.

Note

You can also use an NFS server as a repository. I focus on HTTP and FTP because the details are more intricate.


Space Requirements

Compared with the space available on the latest inexpensive hard drives, the space required for a Fedora repository is not terribly significant. All you need is room for the operating system and the repository. However, if you manage multiple repositories for multiple versions of Fedora on more than one architecture, you can still run out of room quickly. It's best if you plan ahead. If you plan to reinstall Fedora on your computers every time a new version is released, the requirements are straightforward; one possible scenario with an installation and update repository for x86 systems is shown in Table 2-1. This is just a hypothetical breakdown; I've tried to be generous with space requirements.

Table 2-1. Possible Fedora repository space requirements: one release, one architecture

Requirement

Space

Description

Fedora Core

3GB

Typical installation with GUI, without all services

Installation Repository

2.5GB

Fedora Core installation files typically require four CDs

Update Repository

5GB

Some packages are patched multiple times during the life of a distribution. It can be helpful to keep older updates in case of trouble


That doesn't seem so bad. With these requirements, it seems like you can install a Fedora repository on an older computer with a 10GB hard drive. As long as you make sure that your network can handle the load, this seems to be sufficient. But you need to consider additional factors:

As noted on fedora.redhat.com, releases are planned every four to eight months. Updates are made available for about a full year afterwards. If you don't install every new version of Fedora, the update repository requirements may double or more.

If you want to maintain a Fedora update repository for more than a year, you'll have to reconfigure your repository for Fedora Legacy updates. The space requirements increase accordingly. You may also need to reconfigure the associated configuration files. For more information, see www.fedoralegacy.org.

As you bring new computers online, you may want to install later releases of Fedora. Each release requires its own installation and update repository, which could double associated space requirements yet again.

Fedora is also available for 64-bit x86-64 systems. If you want to install and maintain Fedora on these computers (and continue to maintain regular 32-bit systems), the requirements on your installation and update repositories might double yet again.

Personally, I enjoy installing Linux on my computers. However, preserving the configuration and personal files associated with older versions can be a tedious process. After Linux is installed, you may not want to reinstall another version until there are significant changes, such as a major new kernel. It's normally two or three years between major kernel releases (such as between versions 2.4 and 2.6). By then, you could be maintaining client computers with multiple architectures. It's easy to see how a repository could grow to hundreds of gigabytes.

Creating a Dedicated Partition During Installation

It's easiest to configure partitions for Fedora Core during the installation process. The Disk Druid screen shown in Figure 2-1 allows you to dedicate partitions or logical volumes to the directory of your choice.

Figure 2-1. You can configure partitions with Fedora Disk Druid


In Disk Druid, just click Add, and then you can assign a directory such as /var/ftp to a partition such as /dev/hda5. Alternatively, if there's room on a Logical Volume Management (LVM) physical volume (PV), you can assign space from that area for your repository.

Creating a Dedicated Partition After Installation

You can still configure a dedicated partition for your repository after Linux is installed. All you need is sufficient free space on an available hard drive. For example, assume that you've added a second hard drive on your computer and want to dedicate that space to a repository. You could then use fdisk to create a new partition on that drive. Just take the following steps:

1.

Make sure you have sufficient room for your desired repository. The fdisk -l command lists available space on attached hard drives.

As you can see in Figure 2-2, I have an empty 10GB IDE hard drive on /dev/hda. I'll want to dedicate this entire drive as a partition for the /var/ftp directory.

Figure 2-2. Finding the current partition table


2.

Run the fdisk /dev/hda command to open that hard drive to edit its partition table.

3.

Run the p command; this confirms an empty partition table for this hard drive.

4.

Run the n command; you're prompted as shown whether you want to create a primary or an extended partition.

5.

Press p; you're prompted for a partition number between 1 and 4. As this is the first partition on this particular drive, press 1.

6.

Accept the default values for the first and last cylinder; these actions assign the entire hard drive to the new partition.

If you wanted to limit the size of the new partition, you could have specified a size in kilobytes (K) or megabytes (M). For example, if you wanted a 5GB partition, you could have entered +5000M at the Last cylinder prompt.

7.

Press p to review the result on this hard drive's partition table. You can review the result in Figure 2-3.

Figure 2-3. Creating a new partition


If you're satisfied, press w to write the partition table to the hard drive. For a list of other fdisk commands, press m.

8.

If the partition you create is on a hard drive that's currently being used on your system, you'll have to reboot Linux to reread the partition table. While you could force things, the results could be disastrous for your data.

Note

For more information on fdisk and partitions, see the Linux Partition HOWTO at www.tldp.org/HOWTO/Partition/index.html.


After you've created a new partition, the remaining steps are straightforward. All you need to do is format the partition, mount it on a temporary directory, copy existing data, and then bring the result into your partition table. The next time you boot Linux, it'll boot the desired directory on your new partition automatically. For details, take the following steps:

1.

Format the new partition. For example, if the new partition is /dev/hdb1, you'd run the following command:

mkfs.ext3 /dev/hdb1


2.

If the partition is already mounted on an active directory, Fedora Core won't format the partition; it returns an error message.

Note

Don't run a format command such as mkfs or fdformat on an active partition. It can destroy data on that partition and possibly more. While distributions, such as the latest versions of Fedora Core, include safety settings that may warn you against formatting a partition, the risk is still there.

3.

When the format is complete, make sure journaling is enabled. Because the default Fedora ext3 file system is a journaling file system, you may want to make sure journaling is configured on the new partition:

tune2fs -j /dev/hdb1


4.

Now you can mount the new partition on the directory of your choice. For now, you'll want to mount it on a temporary directory; I often create /mnt/test for this purpose. To mount the newly formatted /dev/hdb1 partition, run the following command:

mount /dev/hdb1 /mnt/test


5.

Now you can copy the files from the directory that you want to mount on the newly formatted partition. For example, if you want to create a repository on a local FTP server, copy the files from the local FTP source directory, /var/ftp to /mnt/test. The cp -ar command copies any subdirectories recursively.

cp -ar /var/ftp/* /mnt/test


6.

Document the desired mount in your partition table configuration file, /etc/fstab. Open it in the text editor of your choice. Based on the information shown here, you would add the following line:

/dev/hdb1            /var/ftp           ext3       defaults           1 2 


7.

Save your changes and reboot.

8.

The next time Linux boots, it should mount the /var/ftp directory on /dev/hdb1. You can verify this with the mount command. You can now create a Fedora repository on this partition, with confidence that what you save here won't be crowded out by other services or files that users might save to this computer.

Configuring Fedora for a New Repository Computer

If you haven't already done so, you should run the Update Agent on this computer. Before you use it as a repository for other computers on your network, you should make sure this computer itself is up to date!

The steps are quite similar to those you've seen for RHEL in Chapter 1; one major difference is that you do not have to register your Fedora Linux computer on the Red Hat Network.

2.1.2. Creating a Repository

Now that you have a dedicated partition, you can create the repository that you need for the computers on your network. While we detail the process in later chapters, we describe the basic steps here:

1.

Select a Web or FTP server. As discussed in Chapter 1, Fedora clients look for updates on Web and FTP servers.

2.

Plan the directory tree for the repository. You'll need separate directories for at least the installation and updates.

3.

Download the files for the repository.

4.

Synchronize the repository. You may want to create and automate scripts to keep that repository up to date.

Note

If you're creating a repository for Fedora Core 3 or later, the tools have been changed. The standard command is yum-arch; those who create yum repositories are moving toward the createrepo command. We'll discuss the use of both tools in Chapter 6, "Configuring a yum Client," and Chapter 7, "Setting Up a yum Repository."


Selecting a Service

As described in Chapter 1, Fedora clients pull updates from FTP and HTTP (Web) servers. You learned how to point a Fedora client to a FTP or HTTP mirror. You'll want to create your repository on an FTP, NFS, or HTTP server, which is what Fedora users are familiar with. While I personally prefer FTP because the protocol is inherently faster, some prefer the security associated with an HTTP (or even an HTTPS) server.

After you choose a service, you should set up a dedicated partition, as described earlier in this chapter. Then you can install and configure the service of your choice. We'll show you how to configure a yum repository on a vsFTP server in Chapter 7.

Planning the Tree

Next, you'll need to plan the directory structure. The simplest plan is to mirror an existing repository from a server connected to the Internet. But as many repositories are configured for multiple architectures, mirroring may download much more than what you need.

There is a substantial number of directories associated with Fedora Core repositories. If you don't need development, testing, or source packages, you do not need all the standard repository directories on your system. In fact, you may want to discourage users from downloading and installing developmental packages, because they may have unpredictable effects on your system.

For the latest releases of Fedora Core, you may need to justify your use of different repository directories. Some of the options include

Core and ExtrasCore includes the basic packages associated with Fedora. Extras include additional tools that can be added by individual developers and have often gone through less testing.

Different Fedora Core releasesIf you are configuring a repository for clients where Fedora Core 2, 3, 4, and 5 are installed, you'll need different repository trees for each. Each release includes subdirectories for source RPMs and released architectures.

Development and test releasesAs described in Chapter 1, development releases include new features as they're developed, even on a nightly basis. Test releases are the "beta" versions of Fedora. Generally, you can avoid these repository trees completely.

UpdatesThese are key. They include the patches and updates that you want your users to have and install on their systems (after you test and approve them, of course). There are testing and released updates.

Unless you're a Fedora developer, you don't want or need most of these directory trees in your repository.

Downloading and Synchronizing

Now that you know what you want to download, you can proceed with the process. With the right command, such as rsync or wget, you can download the repository trees of your choice. We'll describe this process in more detail in Chapter 7. There are a number of developers who have automated this process.

Note

You can use the basic directions in Chapter 3, "SUSE's Update Systems and rsync Mirrors," to create a local mirror of any repository with the rsync command. While Chapter 3 applies to SUSE, the basic commands apply to any repository on an rsync server.




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

Similar book on Amazon

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