Linux-Local-Yum-Up2date-Repo
From DevRandom
Yum/Up2date Local Repositories
Steps to create a local yum/up2date repository using RHEL iso images.
Contents |
Download the images
Download the ISO, Copy to the server & mount it to a folder
For eg. /var/www/localrepo/rhel4-x64/iso
For this to persist across reboots, add this to /etc/fstab
/var/www/localrepo/RHEL4.7-x86_64-ES-DVD.iso /var/www/localrepo/rhel4-x64/iso iso9660 loop 0 0
Creating repository for RHEL 5
Download the following from fedora EPEL. The package versions may differ. You can remove these packages after creating the repository
python-urlgrabber-2.9.8-0.3.el4.noarch.rpm createrepo-0.4.4-0.4.el4.noarch.rpm
Change to the directory above the iso directory
cd /var/www/localrepo/rhel4-x64 createrepo
This will create the following
repodata/ repodata/filelists.xml.gz repodata/other.xml.gz repodata/primary.xml.gz repodata/repomd.xml
Creating repository for RHEL 4
Download & Install the following. Dag weirs or similar repositories will have these packages. You can remove these packages after creating the repository
python-sqlite-1.0.1-1.2.el4.rf.x86_64.rpm sqlite-2.8.16-1.2.el4.rf.x86_64.rpm python-elementtree-1.2.6-7.el4.rf.x86_64.rpm yum-2.4.2-0.4.el4.rf.noarch.rpm
Then do the following
cd /var/www/localrepo/rhel4-x64 yum-arch
This will create a headers directory, header.info inside it and other RPM headers
Configure Apache
On the server that is serving the repository configure Apache by creating a vhost similar to this. Since we are serving a RHEL repo, allow access only from the servers that need this
<VirtualHost *:80>
ServerName localrepo
ServerAdmin root@dr-index
DocumentRoot /var/www/localrepo
ErrorLog logs/localrepo-error_log
CustomLog logs/localrepo-access_log common
# Since we are serving a RHEL repo, allow access only from their servers
<Directory /var/www/localrepo>
Order Deny,Allow
Deny from all
Allow from <network> #eg 192.168.202.0/255.255.255.0
</Directory>
</VirtualHost>
Configure Clients - RHEL 5
On the server that needs this repo.
Add the Repo server IP to /etc/hosts 192.168.XXX.XXX localrepo
vi /etc/yum.repos.d/localrepo.repo
[RH51-Server] name= RHEL 5.1 Local Repository baseurl=http://localrepo/rhel4-x64 enabled=1
Check
yum list yum repolist
Configure Clients - RHEL4
On the server that needs this repo.
Add the Repo server IP to /etc/hosts 192.168.206.173 localrepo
Edit /etc/sysconfig/rhn/sources
Comment this line
up2date default becomes #up2date default
Also add this line on the equivalent for the repository you are building
eg.
yum localrepo http://localrepo/rhel4-x64
Test
up2date --showall






