How to create a local ULN mirror

by Jared Greenwald and Avi Miller

Table of Contents

Published October 2013

This document explains how to create a local mirror of the Unbreakable Linux Network repositories and configure yum to install and update packages from these repositories.

OTN is all about helping you become familiar enough with Oracle technologies to make an informed decision. Articles, software downloads, documentation, and more. Join up and get the technical resources you need to do your job.

Prerequisites

Ensure you have the following prerequisites:

Server setup

The steps below describe how to download the latest packages from the Unbreakable Linux Network and make the packages available through a local yum server. You can create and host i386, x86_64, and ia64 repositories on a single machine.

  1. Ensure that you have activated your Oracle Linux CSI and enabled your account on the Unbreakable Linux Network.
  2. Register the machine with the Unbreakable Linux Network.

    For Oracle Linux 5:

    1. Import the RPM GPG key as the root user:
      # rpm --import /usr/share/rhn/RPM-GPG-KEY
    2. Run up2date in text mode as the root user:
      # up2date-nox --register
    3. Register the machine. Enter your ULN username, password and a valid CSI.

    For Oracle Linux 6:

    1. Run the uln_register command as the root user:
      # uln_register
    2. Register the machine. Enter your ULN username, password and a valid CSI.
  3. Enable the yum server option for your newly registered server:
    1. Navigate to the Unbreakable Linux Network.
    2. Log in with the username and password that you used to register the machine.
    3. Click the Systems tab on the upper right corner.
    4. Find the registered machine on the list and click it.
    5. Click the Edit button.
    6. Select the Yum Server checkbox and click the Apply Changes button.
  4. Subscribe the server to the required addons channel.

    After registration with ULN, the machine is automatically subscribed to the appropriate latest channel. You need to manually register the machine to the correct addons channel to install the yum-uln-mirror package. See the required channels by operating system table for details on the specific channels that are required for Oracle Linux 5 and 6.

    1. Click the Manage Subscriptions button.
    2. Select the required channels from the Available Channels list and click the > button to add them to the Subscribed Channels list.
    3. When you have setup the Subscribed Channels list, click the Save Subscriptions button.

      If you want to add an additional channel to your yum mirror, add it to the Subscribed Channels list on ULN. The next time the uln-yum-mirror script runs, it will automatically mirror any additional channels that have been added.

  5. Install the uln-yum-mirror package as the root user:
    # yum install uln-yum-mirror

    This package installs the /usr/bin/uln-yum-mirror script and automatically configures a daily cronjob to update your local yum repositories. You can adjust the configuration of the script by editing the /etc/sysconfig/uln-yum-mirror file. Configuration options are discussed later in script configuration options.

  6. Create a yum repository base directory in /var/www/html.

    This directory will house the repository. Make sure that the yum repository owner has read and write permission on this directory.

    # mkdir -p /var/www/html/yum
  7. Enable and start the Apache web server. Run the following commands as the root user:
    # chkconfig httpd on
    # /etc/init.d/httpd start

How the repository synchronization works

By default, the uln-yum-mirror is configured to run once a day via an /etc/cron.daily script. You can disable the automatic daily cronjob by editing /etc/sysconfig/uln-yum-mirror and setting CRON_ENABLED to 0.

The initial synchronisation will be triggered automatically overnight by the configured cronjob (unless manually disabled). If you have disabled the cronjob, run the uln-yum-mirror script manually to build the local yum repositories.

Note: When the script first runs, it can take several days to complete, depending on the number of channels that are being mirrored.

Mirror configuation options

The uln-yum-mirror script is controlled by the /etc/sysconfig/uln-yum-mirror configuration file. The following configuation options are available:

SRC = [ 0 | 1 ]
The SRC parameter determines whether or not the script also mirrors the associated .src.rpm files. The default is 0 which means the source packages are not mirrored. Change the value to 1 to include source packages in the mirror.
ALL_PKGS = [ 0 | 1 ]
The ALL_PKGS parameter specifies whether the script mirrors all available packages or just the latest packages in each channel. The default is 1 which means that all versions of every available package is mirrored. Set this to 0 to only download the latest version of each package.
CRON_ENABLED = [ 0 | 1 ]
The CRON_ENABLED parameter determines whether or not the daily cronjob is enabled for automatic mirroring of channels on a daily basis. If this parameter is set to 0, the uln-yum-mirror script will need to be manually run to update the local mirror.
REP_BASE
REPO_FILE_DIR
YUM_GLOBAL_CACHE
These parameters specify the paths of the mirrored channels and yum cache directory. Do not change these settings unless you need to customize the configuration of the web server.
REP_ENG
REP_EL
REP_OL
REP_OVM
REP_UNK
These parameters determine the parent path name for each of the various channel types. You can configure an alternative name for each of the channel groups.

Client setup

When you have set up the repository server, configure clients to use the repositories you just set up.

Oracle Linux clients

  1. Import the GPG key as the root user:
    # rpm --import /usr/share/rhn/RPM-GPG-KEY
  2. Create a yum repository configuration file in /etc/yum.repos.d using the following format:

    [<channel_label>]
    name=<Channel Description>
    baseurl=http://<repository_server>/yum/<repository path>
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY
    enabled=1

    For example:

    [ol5_latest]
    name=Oracle Linux $releasever - $basearch - latest
    baseurl=http://<repository_server>/yum/OracleLinux/OL5/latest/$basearch/
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY enabled=1

    You can browse http://<repository_server>/yum/ to find thebaseurl for each repository. You can also use the $releasever and $basearch parameters.

To test that yum is correctly configured to install and update packages from your local yum repository:

  1. Clear the yum metadata cache:
    # yum clean metadata
  2. Ensure the correct channels are configured:
    # yum repolist

Review the Oracle Linux documentation on using yum to install new packages and upgrade existing packages.

Oracle VM 3 clients

  1. For an Oracle VM 3 configuration, add the repository URL to the Oracle VM 3 Manager configuration by selecting Tools -> Server Update Management (YUM) and then entering the following information:
    YUM Base URL:
    http://<repository_server>/yum/OracleVM/OVM3/3.0/latest/x86_64/
    Enable GPG Key:
    Yes
    YUM GPG Key:
    file:///etc/pki/rpm-gpg/RPM-GPG-KEY

    Depending on your mirror configuration, you could use one of the following for the yum base URL instead:

    http://<repository_server>/yum/OracleVM/OVM3/3.0/base/x86_64/
    http://<repository_server>/yum/OracleVM/OVM3/3.0.2/base/x86_64/
    http://<repository_server>/yum/OracleVM/OVM3/3.0.3/base/x86_64/
    http://<repository_server>/yum/OracleVM/OVM3/3.0/patch/x86_64/
    http://<repository_server>/yum/OracleVM/OVM3/3.0.3/patch/x86_64/
    http://<repository_server>/yum/OracleVM/OVM3/3.1.1/base/x86_64/
    http://<repository_server>/yum/OracleVM/OVM3/3.1.1/patch/x86_64/
    

Oracle VM Manager should be used to upgrade Oracle VM Servers. Check the Oracle VM documentation for instructions.

Tables

Disk storage requirements

Below you will find an indicative list of the disk space required to mirror the latest Oracle Linux and Oracle VM channels at the time of writing this article. Note that this list is not comprehensive and will change over time. Care should be taken to ensure that you have sufficient disk space available.

Table 1. Minimum Space Requirements for current Oracle Linux 5 Channels
Channel Label Latest Binaries All Binaries Latest Source & Binaries All Source & Binaries
el5_unsupported_<arch>_latest
2 GB
10 GB
2 GB
16 GB
el5_<arch>_addons
500 MB
4 GB
500 MB
6 GB
el5_<arch>_latest
4 GB
40 GB
8 GB
80 GB
el5_<arch>_oracle
1 GB
3 GB
1 GB
3 GB
ol5_u10_<arch>_base
4 GB
4 GB
7 GB
7 GB
ol5_u10_x86_64_patch
500 MB
1 GB
1 GB
2 GB
ol5_<arch>_ksplice
4 GB
30 GB
4 GB
30 GB
ol5_<arch>_latest
4 GB
25 GB
8 GB
45 GB
ol5_<arch>_UEK_latest
150 MB
4 GB
200 MB
6 GB

Table 2. Minimum Space Requirements for current Oracle Linux 6 Channels
Channel Label Latest Binaries All Binaries Latest Source & Binaries All Source & Binaries
ol6_playground_<arch>_latest
100 MB
3 GB
200 MB
6 GB
ol6_u4_<arch>_base
5 GB
5 GB
10 GB
10 GB
ol6_u4_<arch>_patch
2 GB
5 GB
3 GB
10 GB
ol6_<arch>_addons
300 MB
3 GB
300 MB
3 GB
ol6_<arch>_Dtrace_latest
100 MB
100 MB
200 MB
200 MB
ol6_<arch>_ksplice
5 GB
30 GB
5 GB
30 GB
ol6_<arch>_latest
7 GB
30 GB
15 GB
65 GB
ol6_<arch>_MySQL
200 MB
1 GB
200 MB
1 GB
ol6_<arch>_MySQL56
250 MB
500 MB
300 MB
500 MB
ol6_<arch>_oracle
350 MB
1 GB
350 MB
1 GB
ol6_<arch>_UEK_latest
100 MB
3 GB
200 MB
6 GB
ol6_<arch>_UEKR3_latest
200 MB
300 MB
250 MB
500 MB

Table 3. Minimum Space Requirements for current Oracle VM channels
Channel Label Latest Binaries All Binaries Latest Source & Binaries All Source & Binaries
ovm3_<arch>_latest
250 MB
2 GB
2 GB
4 GB

Required channels by operating system

Table 4. Required Channels by Operating System Release and Architecture

OS Required Channels
Oracle Linux 5 ol5_<arch>_latest el5_<arch>_addons
Oracle Linux 6 ol6_<arch>_latest ol6_<arch>_addons

See also

About the authors

Revision 2.0, 09/29/2013

See sysadmin-related content for all Oracle technologies by following OTN Systems on Facebook and Twitter.