Reese Knowledgebase

How To create a local mirror of latest Red Hat Enterprise Linux without using Satellite server

View Kristian Reese's profile on LinkedIn


If you like this article, please +1 or Recommend via FB with the provided buttons above:

Article ID: 77
by: Reese K.
Posted: 14 Nov, 2012
Last updated: 09 Jul, 2013
Views: 29436

How To create your own local Red Hat Enterprise Linux yum repository server

To begin, build a virutal machine or stand alone system installing the same OS version of Red Hat you wish to serve as the yum repository.  At the time of this writing, my base OS plus mirror data consumed 14G of disk space so be sure to size your disk appropriately.  This is necessary as you must register the mirror server to a RHN Satellite, which allows the system to receive software updates.  It's also important to know that one physical system cannot subscribe to multiple architecture base channels.  In otherwords, if you install a 64-bit OS, you cannot subscribe to the 32-bit channel.

After the system has been deployed, you're ready to begin:

  1. Register with RHN
    1. ~# rhn_register -vv --nox
  2. Install required packaged
    1. ~# yum install createrepo
    2. ~# yum install yum-utils
  3. Create a directory for the repo and sync the base channel
    1. ~# mkdir /opt/rhel6repo
    2. ~# reposync --gpgcheck -l --repoid=rhel-x86_64-server-6 --download_path=/opt/rhel6repo
      1. Note: This will take a long time to run.  I ran mine overnight
  4. Create repo data
    1. ~# createrepo /opt/rhel6repo
  5. Configure apache to serve the content:
    1. ~# vi /etc/httpd/conf.d/rhel-6-repo.conf

      Alias /rhel-6-repo /opt/rhel6repo

      <Directory /opt/repository>
       Options Indexes MultiViews FollowSymLinks
       Order allow,deny
       Allow from all
      </Directory>
  6. Start/restart apache
    1. ~# service httpd start

Next, configure the clients by adding the repo to the yum config:

~# cat /etc/yum.repos.d/rhel6.repo
[rhel-6-repo]
name=My Red Hat Enterprise Linux $releasever - $basearch
baseurl=http://<IP_ADDRESS>/rhel-6-repo
enabled=1
gpgcheck=0

From the client, verify it can see the mirror with yum repolist

You can disable connectivity to Red Hat network by changing the value of enabled = 0 in the file /etc/yum/pluginconf.d/rhnplugin.conf

Clean out the yum cache and remove old header info on the client.

~# yum clean all

Now, you can list all of the updates available from your local mirror.

~# yum list updates

This article was:   Helpful | Not Helpful
Prev   Next
How to find dead links and delete them     How to install package groups with up2date

Showing: 1-12 of 12  
Comments
amit | 13 Aug, 2013 08:11 AM
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.

Regards,
Amit
ktreese | 13 Aug, 2013 03:07 PM
Hi Amit,

You can configure any server you wish to use the RHEL 6.8 64 bit OS base repository. For example, you can configure yum on a RHEL 6.3 64 bit server to use the RHEL 6.8 repo. Should you then issue a 'yum update' command, it'll apply updates to any RHEL 6.3 packages installed on that system.

--
Kristian
amit | 19 Aug, 2013 08:40 AM
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.

Regards,
Amit

On yum server,this is the mismatch::

yum list|wc -l

4050
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
Bill | 22 Jan, 2014 10:26 AM
Hello,
Any ideas on why reposync allows one channel only
while mrepo allows many channels?

My goal is to have a single server exposed to the outside.
Client machines would update from the local mirrors.
All machines are registered with RHN, I have licensing for all.
Disk space is not a concern.

I think reposync is a better method than mrepo, if it would work for multiple channels.

thanks
bp
ktreese | 22 Jan, 2014 01:04 PM
Hi Bill,

Have you looked at https://access.redhat.com/site/node/23016? There is some commentary that asks similar questions. If your goal is one centralized repo hosting multiple channels, that host must be subscribed to those channels. You can use the --repoid=channel-id option to reposync in order to download the packages from RHN from inputted channel-id. According to the reposync man page, --repoid can be specified multiple times.

If this doesn't help, hopefully someone from RedHat will respond to your inquiry :)

--
kreese
Patrick | 25 Nov, 2014 07:09 AM
I am getting this error after following your article:
http://ip-address-of-repo-server/REPO/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.

your help will be appreciated...
Patrick | 25 Nov, 2014 07:10 AM
I am getting this error on redhat client after following your article:

http://ip-address-of-repo-server/REPO/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"
Trying other mirror.

your help will be appreciated...
ktreese | 26 Nov, 2014 02:50 PM
Patrick,

I would start by looking at your apache error_log. Since you're getting a HTTP return code 404 (Page not found), it may provide some insight as to where the problem lies. One thing you may want to check would be that the specified Directory defined in rhel-6-repo.conf is correct and matches up with your file system structure.

Hope this helps.

--
kreese
Patrick | 05 Dec, 2014 09:55 AM
ktreese,

The directory configuration was correct. The repository is now working with below changes;
1. moved my /REPO directory to /var/www/hmtl/REPO - since my master server is serving updates via apache.
2. changed the apache file with this directory path /var/www/hmtl/REPO
2. did a createrepo on /var/www/html/REPO
3. on the client maintained the configuration.
4. yum repolist on the client and all 14,313 packages from redhat were visible.

rgds,patrick
Bret | 23 Mar, 2015 08:34 AM
Reese,

This article, by far, has been the best explanation I have come across for a "step by step" implementation of a Repository Server. Thank you for your clear, concise cook-book approach for the implementation of a Repo server. Excellent!

Bret
Brian Peront | 01 Jun, 2015 01:40 PM
Hi all,

I have done all steps, for some reason YUM says all rpms are "up to date" but I have added more rpms to the local mirror.

Any reason why yum is not happy ?

Thanks
Brian
ktreese | 02 Jun, 2015 05:55 PM
Hi Brian

Did you rerun createrepo after you added additional rpms? Otherwise, the rpm metadata knows nothing about the new ones added. You'll want to use the --update option since the metadata already exists from the first time you ran createrepo. Give it a try.

Thanks

Kristian
Prev   Next
How to find dead links and delete them     How to install package groups with up2date

RSS