User Tools

Site Tools


linux:redhat:local-repo

Local Repository

RHEL 7

Easiest way is to copy media.repo from DVD and create a new direcotry /media/dvd

then edit it and add

enabled=1
baseurl=file:///media/dvd/

RHEL 6

These are instruction on how to create a local repo on a machine with internet access and use it to update the resto fo your RH boxes.

This only works for 1 minor release, so if you have both 6.4 and 6.3 you will need 2 machines.

Creating Directory

For this to work you need to have apache (yum install httpd) installed

First you need to create a folder where you will be importing your RPMs

#mkdir /rpository site

These reposites can be pretty large (over 15 GBs) so if you use a separate disk you will need to create a link to it on /var/www/html/repo for example

#ln -s /mnt/rhel-x86_64-server-6.4.z/getPackage /var/www/html/rhel64

Reposync

Ensure that you have yum-utils and createrepo installed

Before you can use reposync your machine needs to be subscribed to RedHat this will give you your repoid

to check this run:

#yum repolist

Here is what it looks like:

Loaded plugins: product-id, refresh-packagekit, rhnplugin, security,
            : subscription-manager
This system is receiving updates from RHN Classic or RHN Satellite.
repo id                   repo name                                       status
epel                      Extra Packages for Enterprise Linux 6 - x86_64  10,899
katello                   Katello Stable                                     329
katello-candlepin         An open source entitlement management system.        9
katello-foreman           Foreman Community Releases                          99
katello-pulp              Pulp Community Releases                             42
rhel-x86_64-server-6.4.z  RHEL EUS Server (v. 6.4.z for 64-bit x86_64)    11,244
repolist: 22,622

On the left you get the repoid that you are subscribed to. You need to use this exactly.

Then you run:

#reposync -p /mnt --repoid=rhel-86_64-server-6.4.z -l

this creates the following folders:

/mnt/rhel-x86_64-server-6.4.z/getPackage where all the RPMS will be downloaded. If you only want to get the newest RPMs then use the -n flag.

This takes a while for the version I did it downloaded 19GB of data with a total of 11242 packages!

Setting up the Repo

Make sure that your HTTPD service is working.

Then check by opening a webpage to the http://server-name/reponame you should see all your packages.

Creating the repo:

  • move to the /var/www/html/reponame folder
cd /var/html/www/html/rhel64/
  • createrepo . #note period at end

Thats it your repo should be ready for use

Set up the Yum Clients

You need to create a new repo file in /etc/yum.repos.d I called it rhel6-local.repo

Here is a copy of the one I used:

[rhel6-local]
name=RHEL 6u4 Local Repository
#baseurl=file:///opt/yum/rhel6/
baseurl=http://dubrhupprod.office.local/rhel64
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
enabled=1

Thats it you should now be able to use the new repo to update your machines.

Notes

To just update the regular packages rather than the kernel use the –exclude option

in my case I ended up having to use the following:

#yum --exclde=kernel*,irqbalance* update

added the irqbalance as there was a dependency error

You may need to run run

#yum clean all 

to ensure latest patches are done

Yum Groups

Setting up Yum groups needs the following to work enabling yum groups

linux/redhat/local-repo.txt · Last modified: by 127.0.0.1