User Tools

Site Tools


local_red_hat_repository

Local Red Hat repository

Download and Install mrepo RPM from http://pkgs.repoforge.org/mrepo/

yum localinstall --nogpgcheck mrepo-0.8.8-0.pre1.el6.rft.noarch.rpm

Edit /etc/mrepo.conf to suit your needs:

### Configuration file for mrepo
### The [main] section allows to override mrepo's default settings\\
### The mrepo-example.conf gives an overview of all the possible settings\\
[main]
srcdir = /var/www/html/yum/mrepo
wwwdir = /var/www/html/yum/repo
confdir = /etc/mrepo.conf.d
arch =  x86_64
# Default is sha256. RHEL5 requires sha1 (parameter is then sha)
createrepo-options = --checksum sha

Add /etc/mrepo.conf.d/rhel-5Server.conf to suit your needs:

[rhel-5Server]
name = Red Hat Enterprise Linux Server $release ($arch)
release = 5
arch = x86_64
metadata = yum repomd repoview
updates = rhns:///rhel-$arch-server-5
custom =

Add /etc/mrepo.conf.d/rhel-6Server.conf to suit your needs:

[rhel-6Server]
name = Red Hat Enterprise Linux Server $release ($arch)
release = 6
arch = x86_64
metadata = yum repomd repoview
updates = rhns:///rhel-$arch-server-6
custom =

Run mrepo to generate files/directories

mrepo -vvvvugf

If following error is encountered:

No rhnuuid config option found in /etc/sysconfig/rhn/up2date-uuid.

Run following command:

# UUID=$(uuidgen) ; /bin/echo -e "uuid[comment]=Universally Unique ID for this server\nrhnuuid=$UUID" > /etc/sysconfig/rhn/up2date-uuid

Generate system ID's and register local repo with RHN:

# gensystemid -r 6Server -a x86_64 /var/www/html/yum/mrepo/rhel-6Server-x86_64
RHN Username: <Supply RHN username>
RHN Password: <Supply RHN password>
Writing out file....
# gensystemid -r 5Server -a x86_64 /var/www/html/yum/mrepo/rhel-5Server-x86_64
RHN Username: <Supply RHN username>
RHN Password: <Supply RHN password>
Writing out file....

Fix user rights so Apache can read files:

chmod 755 -R /var/www/html/yum/mrepo/
chmod 755 -R /var/www/html/yum/repo/

Run mrepo again to download all rpm files from RHN

mrepo -vvvvug

Web-server: Add /etc/httpd/conf.d/yum-repository.conf:

NameVirtualHost <mrepo-server IP>
<VirtualHost <mrepo-server IP>>
      ServerName yum-repository
      DocumentRoot /var/www/html/yum/
      <Directory "/var/www/html/yum">
              Options Indexes FollowSymLinks MultiViews
              IndexOptions FancyIndexing
              Order allow,deny
              Allow from all
      </Director>
      CustomLog /var/log/httpd/yum-repository.access.log combined
      ErrorLog /var/log/httpd/yum-repository.error.log
</VirtualHost>                                                

Add a entry to crontab in order to update repositories from RHN on a regular basis. Schedule should be configures to suit your needs /etc/cron.montly/mrepoupdate:

#!/bin/bash
/usr/bin/mrepo -q -ug  

In order to let clients use the repo, do following client configuration:

/etc/yum/yum.repos.d/rhel.repo

[rhel-repo]
name=Red Hat Enterprise Linux $releasever - $basearch
baseurl=http://<mrepo-server IP>/repo/rhel-$releasever-$basearch/RPMS.updates
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Disable RHN:

/etc/yum/pluginconf.d/rhnplugin.conf
enabled = 0

Kickstart install from mrepo

Prepare group file. Copy group file from RHEl5/6 DVD to $srcdir/<reponame>_arch directory. The file should be called <nameofrepo>-comps.xml. RPMS.<nameofrepo> should lead you to the right place. Source Group file can be found on RHEL DVD under Server/repodata directory.

RHEL5 groupfile. Same file with two different names. Hence the RPMS.all and RPMS.updates directory.

/var/www/html/yum/mrepo/rhel-5Server-x86_64/all-comps.xml
/var/www/html/yum/mrepo/rhel-5Server-x86_64/updates-comps.xml

This will generate RHEL5 group metadata (xml) in:

/var/www/html/yum/repo/rhel-5Server-x86_64/RPMS.all/repodata/
/var/www/html/yum/repo/rhel-5Server-x86_64/RPMS.updates/repodata/

RHEL6:

RHEL6 groupfile. Same file with two different names. Hence the RPMS.all and RPMS.updates directory.

/var/www/html/yum/mrepo/rhel-6Server-x86_64/all-comps.xml
/var/www/html/yum/mrepo/rhel-6Server-x86_64/updates-comps.xml

This will generate RHEL6 group metadata (xml) in:

/var/www/html/yum/repo/rhel-6Server-x86_64/RPMS.updates/repodata 
/var/www/html/yum/repo/rhel-6Server-x86_64/RPMS.all/repodata

RHEL5 is expecting installation tree to be in a subfolder called Server.

Make softlink to Server directory:

RHEL5:

cd /var/www/html/yum/repo/rhel-5Server-x86_64
ln -s RPMS.all Server

RHEL6:

Softlink N/A

To use your http repo add following to the beginning of your kickstart file.

RHEL5:

install
url --url http://<IP of Web(REPO) server>/repo/rhel-5Server-x86_64

RHEL6:

install
url --url http://<IP of Web(REPO) server>/repo/rhel-6Server-x86_64/RPMS.all

References
http://igrelease.forge.cnaf.infn.it/doku.php?id=doc:tips:mrepo
http://www.labmonkeys.org/sysadmin/rpm/installing_mrepo_on_rhel5
http://www.brandonhutchinson.com/mrepo_configuration.html
http://lists.repoforge.org/pipermail/tools/2008-November/001368.html

local_red_hat_repository.txt · Last modified: 2011/11/18 13:50 by root