HyperSmash

Monday, 10 December 2012

RHEL Linux : Configure local repository server

Prerequisites:

Need the following packages on the server on which the repository will be configured:
  • HTTPD packages
  • YUM packages
  • Createrepo packages
Need the following package on the client that will fetch updates from the configured repository:
  • YUM packages

Step on repository server :

1. Copy Red Hat Enterprise Linux 5/6 DVD ISO RHELX-XXXX.iso (or the ISO of which you need to create the local repository) from Red Hat Network and create a local repository on the local Repository server. Below are step to create ISO file from RHEL DVD which contain package files.
# umount /mnt/cdrom
# dd if=/dev/cdrom of=/tmp/cdimg1.iso

2. Create the mount point for ISO file which need to mount later.
# mkdir -p /var/www/html/cdrom/iso

3. Mount the ISO file to target directory which created on step 2.
# mount -o loop /RHELX-XXXX.iso /var/www/html/cdrom/iso

4. Navigate to target parent directory.
# cd /var/www/html/cdrom

5. Run the createrepo tool to create local repository.
# createrepo .

6. Run yum to perform house keeping on yum temporary files.
# yum clean all

7. 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:///var/www/html/cdrom
enabled=1
gpgcheck=0 

8.Share with httpd by making sure you have lines as below in your /etc/httpd/conf/httpd.conf file.
ServerAdmin root@<ip_of_your_server> -- local repository servers IP address
DocumentRoot /var/www/html
ServerName <ip_of_your_server> -- local repository servers IP address

9. Verify the HTTPD configuration. If no issues, continue to start the services.
# httpd -t

10. Starting up HTTPD services.
# service httpd start

Step on client machine :

1. Create the repository file to point client to local server that configured. Refer below.
# vi /etc/yum.repos.d/my.repo
[RH51-Server]
name=RHEL X Server Repository
baseurl=http://<ip_of_your_server>/cdrom --local repository IP Address
enabled=1
gpgcheck=0

2. Verify from client machine, test whether able to listing out the available packages file at local repository server or not.
# yum list

3. It's should listing out the available packages on server. If nothing came out, need to drill down on each of step that been done. Make sure the iptables services are stopped  during this configuration.