Tuesday May 07, 2013

Configuring mrepo to mirror ULN package channels

mrepo is a popular tool that can be used to mirror yum repositories for Red Hat Enterprise Linux and its derivatives like Oracle Linux, CentOS and Scientific Linux. This is a brief guide to installing mrepo on Oracle Linux 6 and connecting directly to the Unbreakable Linux Network (ULN) to mirror Oracle Linux packages. You can also use mrepo to mirror the publicly available repositories at http://public-yum.oracle.com.

Note: that mrepo does NOT mirror the errata information used by the yum-security plugin.


This guide assumes that you are familiar with the Oracle Linux 6 installation process, as well as basic system administration tasks, including registering with the Unbreakable Linux Network (ULN) or configuring YUM to use public-yum.oracle.com.  The Oracle Linux 6 Administrator's Solutions Guide provides more information on these tasks.

Oracle Linux 6 Installation

This guide uses Oracle Linux 6.4 (x86_64). Download Oracle Linux 6.4 from the Oracle Software Delivery Cloud or one of the mirrors. You can choose either to do a "Basic Server" install, or a "Minimal" install. I recommend performing a "Basic Server" install as this provides basic system administration tools. If you are using a previous version of Oracle Linux 6, please ensure it is either registered with the Unbreakable Linux Network or is configured to use public-yum.oracle.com for updates.

Register with the Unbreakable Linux Network (ULN)

Once you have installed Oracle Linux, you need to register with ULN. Follow the instructions at https://linux.oracle.com/uln_faq.html to register your server. If you want to mirror additional channels, login to ULN at https://linux.oracle.com, edit your mrepo server and enable the "Yum Server" option. You will then be able to subscribe your server to any available ULN channels for mirroring purposes. You should ensure that you subscribe to the channels you want to mirror before running the mrepo update process.

mrepo Installation

Binary packages of mrepo are available through a yum repository at ‚Äčhttp://repoforge.org. See the "Using RepoForge" page at http://repoforge.org/use/ for instructions on configuring RepoForge for your server.

After you have configured RepoForge access, install mrepo from the rpmforge testing repository using the yum tool:

# yum --enablerepo=rpmforge-testing install mrepo
The mrepo documentation can be found after installation at /usr/share/docs/mrepo-0.8.8/

Install, enable and start Apache:
# yum install httpd
# chkconfig httpd on
# service httpd start
You will need to ensure that any firewalls like iptables are configured to allow access to Apache on port 80.

mrepo Configuration

Once mrepo is installed, some additional configuration steps are required to download packages directly from ULN. Check to see if the /etc/sysconfig/rhn/up2date-uuid file exists. If not, create it manually with the following command:
# UUID=$(uuidgen) ; /bin/echo -e "uuid[comment]=Universally Unique ID for this server\nrhnuuid=$UUID" > /etc/sysconfig/rhn/up2date-uuid
Create a symbolic link to the ULN CA certificate to match the file that mrepo will look for when connecting to ULN:
# ln -s /usr/share/rhn/ULN-CA-CERT /usr/share/rhn/RHNS-CA-CERT
Create an mrepo configuration file for each release of Oracle Linux you want to mirror. The following example is for Oracle Linux 6.

In /etc/mrepo.conf.d/ol6.conf:
name = Oracle Linux Server $release ($arch)
release = 6
arch = i386 x86_64
metadata = repomd
iso = OracleLinux-R6-U3-Server-$arch-dvd.iso
latest = rhns://linux-update.oracle.com/ol6_${arch}_latest
oracle = rhns://linux-update.oracle.com/ol6_${arch}_oracle
uek_latest = rhns://linux-update.oracle.com/ol6_${arch}_UEK_latest
mysql = rhns://linux-update.oracle.com/ol6_${arch}_MySQL
The path used for ULN is rhns://linux-update.oracle.com/label. You can find the appropriate Label for each channel on the Channels tab of ULN at https://linux.oracle.com. You can add or remove channels as you want, but you need to ensure that your  mrepo server is subscribed to all channels you want to mirror on ULN before trying to run mrepo. 

Run mrepo

Once you have configured mrepo, it's time to run it for the first time.
# mrepo -vv
This should mount the ISO files specified in the iso line of your configuration file.
# mrepo -uvv
This will update the repositories from ULN. If you are prompted for an RHN Username and RHN Password by mrepo, it means you have not subscribed your server to that channel on ULN or you have provided the wrong path in your mrepo configuration file. The initial update process can take between 2 to 3 days to mirror the latest channel for each release.
# mrepo -gvv

This will create the yum repository metadata for each repository you are mirroring. 

Further steps

Once this is complete, you can automate mrepo via cron or by using the SystemV init script provided. See the documentation at /usr/share/docs/mrepo-0.8.8/ for more information on further configuration of mrepo. 


Get the latest updates on strategy, products, events, news, customers, partners and all things Oracle Linux! Connect with Oracle's Linux experts.

Stay Connected




« May 2013 »