October 2009
« Aug   Nov »

Redhat YUM Repository for LAN with failover functionality

How to setup yum repository for Redhat.

1. Copy all the files from Redhat/Centos DVD to a local anonymous ftp location.

creating anonymous FTP location.
1, Setup FTP servers or http web share
a. install vsftp on the target system, start the ftp service and copy the files to “/var/ftp/pub ” location. You can access the ftp server at ftp://. Create a secondary also.

2.Create a repo file on ” /etc/yum.repos.d/”
First move all the files to temporoty location.

<strong>[liju@host ~] mv /etc/yum.repos.d/  /etc/yum.repos.d_old
[liju@host ~] mkdir /etc/yum.repos.d/
[liju@host ~] vi /etc/yum.repos.d/myrepo.repo

Add the following lines..

name=RHEL 5.0 Local yum repo!

Save and exit. Again we are going to create baseurls.txt

Do you know what is baseurls.txt stands for ?

baseurls.txt will help us to connect next repository whenever the primary repository server goes down, like a fail over does.

Create a file and add ftp servers details on it.

[liju@host ~] vi /etc/yum.repos.d/baseurls.txt
ftp://ftp ip/pub/Centos5
ftp://ftp ip/pub/Centos5

Save and exit the editor.

Again execute

[liju@host ~]  yum clean all
[liju@host ~] yum update

See the magic, just testing it out now.

[liju@host ~] yum install vsftpd

How do I add packages to “yum” my existing LAN repository.
1. Choose a desktop to install the packages using remote rpm repository like rpmforge or Diag.
2. Edit the yum config file and change the keepcache value to 1.

[root@rc-090 yum.repos.d]# vi /etc/yum.conf

3. After installing the packages using the remote yum repository. Just copy the files from “packages ” under “/var/cache/yum/remoteyum” to our LAN yum repository location. Here I uses rmpforge (/var/cache/yum/rpmforge/packages)
4. Then ssh to remote YUM repository server and go to yum folder.
5. Install createrepo command using yum and create updated yum repository.

[root@rc-040 Centos5]# yum install createrepo
[root@rc-040 Centos5]# cd /home/ftpuser/pub/Centos5
[root@rc-040 Centos5]# createrepo .
2122/2548 – CentOS/tomcat5-servlet-2.4-api-javadoc-5.5.23-0jpp.7.el5_2.1.i386.rp2548/2548 – CentOS/librsvg2-2.16.1-1.el5.i386.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata

That’s it.

Go to client desktop then try to install the package using yum/

hey you will see the magic.
# yum install vlc
zvbi i386 0.2.33-1.el5.rf Concert-Centos-5 925 k

Transaction Summary
Install 78 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 72 M
Is this ok [y/N]:


2 comments to Redhat YUM Repository for LAN with failover functionality

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>