by Jared Greenwald and Avi Miller
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.
|
Ensure you have the following prerequisites:
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.
For Oracle Linux 5:
root user:
# rpm --import /usr/share/rhn/RPM-GPG-KEY
up2date in text mode as the root user:
# up2date-nox --register
For Oracle Linux 6:
uln_register command as the root user:
# uln_register
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.
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.
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.
/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
root user:
# chkconfig httpd on # /etc/init.d/httpd start
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.
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 ]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 ]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 ]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_BASEREPO_FILE_DIRYUM_GLOBAL_CACHEREP_ENGREP_ELREP_OLREP_OVMREP_UNKWhen you have set up the repository server, configure clients to use the repositories you just set up.
root user:
# rpm --import /usr/share/rhn/RPM-GPG-KEY
/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:
# yum clean metadata
# yum repolist
Review the Oracle Linux documentation on using yum to install new packages and upgrade existing packages.
http://<repository_server>/yum/OracleVM/OVM3/3.0/latest/x86_64/file:///etc/pki/rpm-gpg/RPM-GPG-KEYDepending 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.
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 |
| 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 |
| Channel Label | Latest Binaries | All Binaries | Latest Source & Binaries | All Source & Binaries |
|---|---|---|---|---|
| ovm3_<arch>_latest | 250 MB |
2 GB |
2 GB |
4 GB |
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 |
| Revision 2.0, 09/29/2013 |
See sysadmin-related content for all Oracle technologies by following OTN Systems on Facebook and Twitter.