Setting Up A Local RHN Repository With Cobbler

Rants First

I have about 50 licenses for Red Hat in my network, so as you can already guess, updating all the machines is a huge pain. I’m not sure why Red Hat can’t have a mirror geographically closer to Singapore, like in Australia or Hong Kong, or even better still, in Singapore.

Red Hat Satellite is one solution for aggregating the updates. I tried haggling with my Red Hat sales person for a free license, but she was quite straightforward in rejecting me.

Well, there’s always an open source alternative other than the official paid version.

In my infrastructure, I make use of Cobbler to kickstart all my machines. It is not only for initial installation, but also for disaster recovery. In the event of a failure, I will just need to replace the machine and kickstart via Cobbler. Network installation for Red Hat takes about 5 mins. Restoring my last backup from disk archives takes another 15 mins. I’m very convinced that this is way faster than any traditional backup solution.

Anyway, back to the update portion. Since Cobbler is a provisioning system, it is able to make a local repository remote yum repositories. My repository has Red Hat 5/6, CentOS 5/6 and Extra Packages for Enterprise Linux (EPEL).

I won’t going into installing Cobbler. There are a lot of howtos out there. Let me hop straight into the mirroring of RHN updates.

From now on, I’m assuming you have Cobbler all set and running:

On the Cobbler Server

1. First thing, the machine that’s running Cobbler has to be subscribed to the channels that you are going to mirror. Here comes the caveat. Suppose you are running RHEL6 on the Cobbler machine, you can only mirror RHEL6

2. Check the channels that your cobbler machine is subscribed to.

[[email protected]>  rhn-channel –list

3. Add the repositories to Cobbler

[email protected]> cobbler repo add rhn://rhel-x86_64-server-6 –name rhel-x86_64-server-6

4. Start the cobbler sync manually to mirror the repository

[email protected]> cobbler reposync –only=rhel-x86_64-server-6

On the Cobbler Clients

1. Disable RHN. Because the repo name we use in Cobbler is the same as the actual RedHat channel, we need to disable RHN or there will be a conflict when you do a yum update.

[email protected]> vi /etc/yum/pluginconf.d/rhnplugin.conf

enabled = 0
gpgcheck = 1

Set enabled = 0

2. Add your brand new RHEL yum repo in your /etc/yum.conf or /etc/yum.repos.d/

3. yum update and you will see that you are updating from your local repo.

That’s it folks! It’s not difficult. And you will find updating RedHat less painful.

Author: yibi

YiBi's numb :) YiBi writes about anything. Technology, Gossips, Rubbish YiBi's a half f%#k geek :P

7 Replies to “Setting Up A Local RHN Repository With Cobbler”

  1. Hi,

    I am trying to configure yum repository following your article.

    IF i configure repository on base OS RHEL 6.8 64 bit,will this server to all RHEL 6.x 64 bit version OS or only RHEL 6.8 version only.
    Please clarify.

    Thanks in advance.


  2. Hi All,

    I setup local yum repository for my company’s local environment.
    Now there are 10,000 packages in the folder /opt/rhel6repo where i downloded rpm from RHN.While i am trying to yum list on yum server,only 4050 rpms are shown,is there something wrong.

    On the yum client machine,whee i want to install packages,only 4000+ rpms are shown.

    I think count should match on yum server and client machines.Please suggest if something is wrong.

    Thanks in advance.


    On yum server,this is the mismatch::

    yum list|wc -l

    yum repolist all
    Loaded plugins: aliases, changelog, downloadonly, kabi, presto, product-id, rhnplugin, security, subscription-manager, tmprepo, verify, versionlock
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    This system is receiving updates from RHN Classic or RHN Satellite.
    Loading support for Red Hat kernel ABI
    repo id repo name status
    rhel-source Red Hat Enterprise Linux 6Server – x86_64 – Source disabled
    rhel-source-beta Red Hat Enterprise Linux 6Server Beta – x86_64 – Source disabled
    rhel-x86_64-server-6 Red Hat Enterprise Linux Server (v. 6 for 64-bit x86_64) enabled: 10,835
    repolist: 10,835

    1. Hi, that was some time back in 2011/2012. The updates were coming from Europe if I’m not wrong (I’m in Singapore). Things could have changed over these 2 years.

  3. Any suggestions for standing up RHN repos (RH5, RH6) on a CentOS Cobbler host? Basically, like the OP is doing, trying to avoid the RHN Satellite Server costs.

This is useful? Please leave your comment or Share this on Facebook!

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: