Home > Articles > Operating Systems, Server > Linux/UNIX/Open Source

This chapter is from the book

7.6 Creating an Enterprise Repository

In Chapter 2, you learned about patch management on RHEL computers. The Red Hat Network Proxy Server is an effective way to cache RPMs for multiple RHEL systems. However, some administrators prefer standard tools, such as apt and yum.

In this section, we’ll show you how you can configure a yum-based repository from packages downloaded using the Red Hat Update Agent. If you want to use update other RHEL clients from this repository, you may be required by contract to have valid subscription for each of these clients, even if the packages are covered by an open source license.

A working RHEL repository requires a combination of the existing installation packages, as well as the updates available over the Red Hat Network. When combined, you’ll have a set of packages that includes all the dependencies you might need.

The repository creation process on an RHEL system requires four basic steps:

  1. Download the packages required to update your system; make sure they aren’t deleted after they’re installed. Add the packages associated with the RHEL installation CDs.
  2. Apply the yum-arch or createrepo commands to "yummify" the repository.
  3. Share the repository directory with an appropriate service, such as Apache, FTP, or NFS.
  4. Configure your clients to update from the new repository.

Depending on the channels you want to mirror, this process may require 2GB or more of downloads. If you have only one or two RHEL systems, you may find this process not to be worth the trouble. However, if you have several dozen RHEL systems, this might save you time and bandwidth.

If you have a substantial number of RHEL systems, you should consider the Red Hat Network Proxy Server described in Chapter 2. However, if you prefer standard tools, such as yum, and have the authorized Red Hat subscriptions for the RHEL clients on your network, you the approach taken in the following sections is a viable alternative.

7.6.1 Creating a RHEL Update Repository

In Chapter 2, you learned to use the Red Hat Update Agent to update RHEL systems. With the right configuration, you can save the updated RPMs as an RHEL update repository. There are several basic steps in this process:

  1. First, log into the Red Hat Network and assign desired channels to the RHEL Update Repository system.
  2. Next, configure the Update Agent to keep downloaded packages.
  3. Configure the system where you’ll store packages as needed.
  4. Download desired RPMs into your repository.
  5. Add RPMs from the installation CDs.

Assign Desired Channels from the Red Hat Network

First, log into the Red Hat Network. Make sure your system is subscribed to the channels from which you want to create your repository.

As shown in Figure 7-5, you can configure your system with available channels, assuming that you have allowed subscriptions to that channel. To find your currently allowed subscriptions, click Channels on the top bar, then click Channel Entitlements on the left pane. Assign the channels of your choice, and then click Change Subscriptions. If you see the following error message, you may need additional subscriptions:

The assignment would exceed your allowed subscriptions in one or more channels
Figure 7.5

Figure 7-5 Assigning RHEL Channel Subscriptions

To confirm your channel assignments, log into the computer that you intend to use as the repository. The following command should return the channels that you’ve assigned:

up2date --showchannel 

Based on Figure 7-5, the channels that you should see are as follows:

rhel-i386-as-4
rhel-i386-as-4-extras
rhel-i386-as-4-hwcert
rhel-i386-as-4-sdk
rhn-tools-rhel-4-as-i386

Configure the Update Agent to Keep Downloaded RPMs

Log into the computer that you intend to use as a repository. Updated RPMs are stored by default in the /var/spool/up2date directory. Make sure that updated RPMs are not deleted. To do so, run the up2date-config command. You’ll see the screen shown in Figure 7-6.

Figure 7.6

Figure 7-6 Configuring the Update Agent to keep RPMs

Enter option 17 (the option number may vary). This is associated with the "keepAfterInstall" variable. If set to yes, packages which are downloaded remain available in /var/spool/up2date after they’re installed. The next time you download packages from the Red Hat Network, packages will be stored in that directory, and they won’t be deleted.

Configure the Repository with Appropriate Partitions

As you’ve seen throughout this book, repositories require gigabytes of space. It often makes sense to configure repositories in separate partitions. For the purpose of this repository, I’ve configured /var/spool/up2date on a new partition or logical volume.

For details on how you can configure a new partition, refer to any good basic book on Linux administration, including Linux Administration Handbook by Evi Nemeth, Garth Snyder, and Trent Hein (Upper Saddle River, NJ: Prentice Hall, 2002) or Mastering Red Hat Enterprise Linux 3 by Michael Jang (Alameda, CA: Sybex, 2004) . If you want more information on these commands or settings, refer to that book. If you have free space on an available partition, you can assign it to /var/spool/up2date. One method would use the following steps, which assume that you’ve added a new hard drive. The steps may vary widely depending on the hard drive and whether there are existing partitions on that drive.

  1. Open the hard disk of your choice for editing. For example, assume you’ve added a new hard drive. If this drive is the first SCSI or SATA hard drive on your system, run the fdisk /dev/sda command.
  2. Assign a new partition with the n command. You’ll need to press p to assign a new primary partition. Assign partition number 1, start with the first cylinder, and assign the room you need. You can do so with a +10GB entry when prompted for the last cylinder. Press w to write the new partition table to the hard drive.
  3. Format the drive. To format it with the default ext3 file system, run the following command:
  4. mkfs -t ext3 /dev/sda1
  5. Mount the /var/spool/up2date directory on that drive.
  6. mount /dev/sda1 /var/spool/up2date
  7. Make sure the drive is mounted the next time you reboot your computer. Add the following line to your /etc/fstab configuration file:
  8. /dev/sda1 /var/spool/up2date ext3 defaults 1 2

Download Desired RPMs from the Repository

Now you can download the desired RPMs from the Red Hat Network. You can download just the updates, but because of dependencies, those might not be enough. Therefore, download all available RPMs from the Red Hat Network channels to which you subscribe. This is a multi-step process. With the following command (which specifies a RHEL 4 Workstation channel), you can download the RPMs from your desired channel not currently installed on your system. Shortly, you’ll add RPMs from your installation CDs.

up2date -d --installall --channel=rhel-i386-ws-4

There is no separate updates repository on the Red Hat Network. New packages are incorporated into existing channels. Therefore, this command downloads all packages you do not have installed, including any updated RPMs.

Naturally, because there are around 2GB of data on RHEL installation RPMs, the download may be extensive. Depending on the speed of your connection, you may need to wait several hours for downloads. One example is shown in Figure 7-7.

Figure 7.7

Figure 7-7 Downloading updates

Add RPMs from the Installation CDs

Now you should add the RPMs from the RHEL installation CDs. If you have the physical CDs, the mount command is elementary. If you have the ISO files (as I do), the mount command requires a small trick. For example, when I’ve stored the ISOs on my /mnt/test partition, I can mount the first RHEL ISO with the following command:

mount -o loop /mnt/test/RHEL4-i386-AS-disc1.iso /media/cdrecorder

You can then copy the RPMs to the /var/spool/up2date directory with the following command:

cp -ar /media/cdrecorder/RedHat/RPMS/* /var/spool/up2date/

Naturally, when the process is complete with the first CD, you’ll want to unmount and repeat the process with the other RHEL CDs until you’ve copied all available RPMs to the /var/spool/up2date directory.

7.6.2 Yummifying the RHEL Update Repository

After you’ve configured the files you need in the RHEL repository, you can set it up as a yum repository. As described earlier in this chapter, this requires the yum-arch or createrepo commands, depending on your distribution. The createrepo package was adapted for Fedora Core 3. Because RHEL 4 was built from Fedora Core 3, we’ll use this package to "yummify" this repository.

If you haven’t already done so, install the yum and createrepo RPMs. As discussed earlier in this chapter, they are not currently available from RHEL 4 channels. However, compatible versions are available from Fedora Core 3 repositories. Download guidelines are described earlier in this chapter.

Now you can yummify your repository with one of the following commands, whichever is appropriate to your distribution:

yum-arch /var/spool/up2date
createrepo /var/spool/up2date

If successful, you’ll find headers/ or repodata/ subdirectories in the /var/spool/up2date directory. I’ve used the second command on my RHEL 4 system, with downloaded updates and installation RPMs that I’ve just described.

7.6.3 Sharing the RHEL Repository

Now you can share the RHEL 4 repository that you’ve just created. You can configure the Apache or NFS servers described earlier. Unfortunately, as described earlier, the vsFTP service does not follow symlinks, for the security reasons described earlier. In this case, we’ll configure the server that we did not configure before, the Apache Web Server. We won’t go into detail on how to configure Apache on your system; we’ll just create a basic configuration that you can use for a RHEL repository.

If you want more information on how you can configure Apache on RHEL, there are many excellent books available, including Apache Administrator’s Handbook by Rich Bowen (Indianapolis, IN: Sams Publishing, 2002).

In this case, I’ve just installed the httpd RPM package on RHEL 4. To make sure it works, start the daemon with the following command:

apachectl start

If you see a message related to "Could not determine the server’s fully qualified domain name," do not be concerned. There is no URL specified in the default version of the Apache configuration file, httpd.conf, in the /etc/httpd/conf directory.

Test the result. If you’re on the computer with the repository, open a browser and navigate to 127.0.0.1. If the service is working, you’ll see the Red Hat Enterprise Linux Test Page. Test the result on a remote computer. I’ve configured the repository computer with an URL of yum.example.com, and therefore can navigate to that URL to see the same test Web page.

By default, Apache files on this distribution are stored in the /var/www/html directory. You already have a repository in the /var/spool/up2date directory. To allow apache to work with the repository, you need to link directories. One method is with the following command:

ln -s /var/spool/up2date /var/www/html/up2date

If everything goes right, you should be able to navigate to the up2date/directory on the Apache server. In my case, I’ve navigated to http://yum.example.com/up2date/. However, that doesn’t work at first. I’ve started with the default RHEL 4 Apache configuration file. For more information, see the error_log in the /var/log/httpd directory. The key error message from this file is

Directory index forbidden by rule: /var/www/html/

To address this issue, I’ve modified the messages associated with the Apache root directory. The default configuration file includes the following stanza about 25 percent of the way into the file:

<Directory />
  Options FollowSymLinks
  AllowOverride None
</Directory>

The Options directive you need is Indexes, which leads me to substitute the following command line:

Options Indexes FollowSymLinks

Now, you can try the desired URL again. You should see a result similar to Figure 7-8, with a list of files linked from the /var/spool/up2date repository.

Figure 7.8

Figure 7-8 HEL 4 yum Repository

Naturally, you can also share /var/spool/up2date with an NFS server by using the techniques described earlier in this chapter.

7.6.4 Configuring Updates to the RHEL Repository

After you’ve added the packages you need to /var/spool/up2date, it is up to you to maintain that RHEL repository. While the Red Hat Network does not include a rsync server, the effect from updates is essentially the same. You can repeat the same commands described earlier, and only new packages are downloaded. However, obsolete packages are not removed from the local mirror.

However, if you’ve copied all of the installation files to the /var/spool/up2date directory, this is not necessary. You just need the updated RPMs, which are available with the following command:

up2date -u

If you want to keep using /var/spool/up2date, make sure that you never restore the defaults associated with the Red Hat Update Agent. Otherwise, the updated RPMs would be deleted after the next update. (You may also want to disable upgrades to the up2date RPM, as described in an earlier note.)

7.6.5 Configuring Clients to Use the RHEL Repository

Naturally, if you’ve created a repository on a RHEL computer, you may want to use it for that computer. You’ve already downloaded and installed the yum RPM package. You can now create a configuration file in the /etc/yum.repos.d directory similar to those you’ve created in Chapter 6. In this case, the repository is local; therefore, you can specify the file:/// (that’s three forward slashes) label described earlier to point to the /var/spool/up2date directory.

For example, I’ve entered the following in the local.repo file in the /etc/yum.repos.d directory:

[local]
name=Mike’s local RHEL 4 repo
baseurl=file:///var/spool/up2date 
gpgcheck=1
enabled=1

Now I can use the yum commands described in Chapter 6 to update the system with the repository. Naturally, you can configure other RHEL 4 clients to use the same repository. Based on the Apache server configured earlier, I’ve modified the aforementioned local.repo file accordingly:

[local]
name=Mike’s local RHEL 4 repo
baseurl=http://yum.example.com/up2date 
gpgcheck=1
enabled=1

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020