User Tools

Site Tools


local_red_hat_repository

This is an old revision of the document!


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

In case you want to kickstart install from mrepo

Prepare group file. Copy group file from RHEl5/6 DVD to repodata directory. Group file can be found on DVD under Server/repodata directory.

RHEL5:

cd /var/www/html/yum/repo/rhel-5Server-x86_64/RPMS.all
createrepo -s sha -g /var/www/html/yum/repo/rhel-5Server-x86_64/RPMS.all/repodata/comps-rhel5-server-core.xml .

RHEL6:

cd /var/www/html/yum/repo/rhel-6Server-x86_64/RPMS.all
createrepo -s sha -g /var/www/html/yum/repo/rhel-6Server-x86_64/RPMS.all/repodata/comps-rhel6-server-core.xml .

Make softlink to Server directory:

RHEL:

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

RHEL6:

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

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

local_red_hat_repository.1321457438.txt.gz · Last modified: 2011/11/16 15:30 by root