Sunday, August 21, 2011

yum local repository setup

Environment
•Red Hat Enterprise Linux 5
•Red Hat Enterprise Linux 6

•Prerequisites :◦You will need the following packages on the server on which the repository will be configured :
httpd
yum
createrepo◦following package on the client which will fetch updates from the configured repository :
yum


Steps :
1.
Copy Red Hat Enterprise Linux 5/6 DVD ISO RHEL5-Client-20070208.0-i386-DVD.iso from Red Hat Network and create a local repository on the local Repository server.
#mkdir -p /var/www/html/cdrom/iso
#mount -o loop /RHELX-Client-20070208.0-i386-DVD.iso /var/www/html/cdrom/iso
#cd /var/www/html/cdrom
#createrepo .
#yum clean all

2.Create a file /etc/yum.repos.d/file.repo which should have the contents as mentioned below :#cat /etc/yum.repos.d/file.repo
[RHEL-Repository]
name=RHEL repository
baseurl=file:///cdrom
enabled=1
gpgcheck=0
3.
Share with httpd by making sure you have lines like these in your /etc/httpd/conf/httpd.conf file:
ServerAdmin root@10.65.6.141
DocumentRoot /var/www/html
ServerName 10.65.6.141
(Where 10.65.6.141 is the local Repository server)
#httpd -t
#service httpd start
4.
Client side configuration:
#vi /etc/yum.repos.d/my.repo
----
[RH51-Server]
name= RHEL X Server Repository
baseurl=http://10.65.6.141/cdrom
enabled=1
gpgcheck=0
----
5.
Verify from client:
#yum list
Loading "installonlyn" plugin
Setting up repositories
Reading repository metadata in from local files
Available Packages
Deployment_Guide-as-IN.noarch 5.0.0-19
RH51-Server Deployment_Guide-bn-IN.noarch
5.0.0-19 RH51-Server
Deployment_Guide-de-DE.noarch 5.0.0-19
RH51-Server Deployment_Guide-en-US.noarch
5.0.0-19 RH51-Server
Deployment_Guide-es-ES.noarch 5.0.0-19
RH51-Server Deployment_Guide-fr-FR.noarch
5.0.0-19 RH51-Server ========
OR
#yum update