Tuesday, December 27, 2011

Configure Yum Server on Red Hat Enterprise Linux 5(Part-3)


Configuring Yum on RHEL 5.x For Internet Access (Part-3)

In my previous tutorials you have shown that how to configure yum server for Local uses, but it is also possible to donwload and install packages via internet. If you want to do iths then you have to change few things in yum configuration, so take a look the steps.

Step-1: Mount the RHEL5 DVD.

Insert the RHEL5 DVD into your DVD-ROM and create a directory under the /mnt/ directory named rhel5 then mount the DVD into /mnt/rhel5/ directory.

[root@yumsrv ~]# mkdir /mnt/rhel5
[root@yumsrv ~]# mount /dev/block device name /mnt/rhel5/

Step-2: Copy all the files from DVD source.

Create a directory into /home/rhel5 (or any other places) then copy all the files from /mnt/rhel5 directory and keep into /home/rhel5 directory

[root@yumsrv ~]# mkdir /home/rhel5
[root@yumsrv ~]# cp –r /mnt/rhel5/* /home/rhel5/

Step-3: Install createrepo RPM package for creating Repository file for DVD source.

Now go to the mount point directory (home/rhel5/) and execute the command below for installing the RPM package.

[root@yumsrv ~]# cd /home/rhel5/Server/
[root@yumsrv Server]# rpm –ivh createrepo-0.4.11-3.el5.noarch.rpm

Step-4: Creating Repository file.

Now go to the /home/rhel5/ directory and create repodata file for DVD source.

[root@yumsrv ~]# cd /home/rhel5/
[root@yumsrv rhel5]# createrepo .

Step-5: Create an ISO file for this DVD source.

[root@yumsrv ~]# mkisofs –o /opt/RHEL5.iso –l –r /home/rhel5/

Step-6: Create a mount point directory for the ISO file.

Create a directory in /var/www/html/ named “rhel5” which will act as mount point for this ISO file.

[root@yumsrv ~]# mkdir /var/www/html/rhel5
[root@yumserver ~]# mount –r –o loop –t iso9660 /opt/RHEL5.iso /var/www/html /rhel5/

Step-7: Mounting the Image upon system Restart.

Now you have to permanently mount the ISO file that it will automatically mount at every Boot. So we have to edit fstab file for this.

[root@yumsrv ~]# vi /etc/fstab

Then type this path followed by space or tab key

/opt/RHEL5.iso  /var/www/html/rhel5/ iso9660 ro,loop,auto 0 0

Step-8: Edit yum.conf file.

Now finally tell to yum use this “repo” file for installation. It will be automatically done by configuring yum.conf file.

[root@yumsrv ~]# vi /etc/yum.conf

[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.centos.org/centos/5/os/i386/
enabled=1
gpgcheck=0

[updates]
name=Red Hat Linux $releasever - Updates
baseurl=http://mirror.centos.org/centos/5/updates/i386/
enabled=1
gpgcheck=0

[Server]
name=rhel5-Server
baseurl=file:///var/www/html/rhel5/Server/
enabled=1
gpgcheck=0

[Cluster]
name=rhel5-Cluster
baseurl=file:///var/www/html/rhel5/Cluster/
enabled=1
gpgcheck=0

[ClusterStorage]
name=rhel5-ClusterStorage
baseurl=file:///var/www/html/rhel5/ClusterStorage/
enabled=1
gpgcheck=0

[VT]
name=rhel5-Virtualization
baseurl=file:///var/www/html/rhel5/VT/
enabled=1
gpgcheck=0

gpgkey=file:///var/www/html/rhel5/RPM-GPG-KEY-redhat-release

Step-9: Create Local debug information.

Now configure the debug information for DVD source by editing rhel-debuginfo.repo file.

[root@yumsrv ~]# cd /etc/yum.repos.d/
[root@yumsrv yum.repos.d]# vi rhel-debuginfo.repo

[rhel-debuginfo]
name=Red Hat Enterprise Linux- Debuging-Packages
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Step-10: Disable RHN Plug-ins.

Now finally disable the RHN plug-ins and tell to yum that just install only the packages not plug-ins.

[root@yumsrv ~]# cd /etc/yum/pluginconf.d
[root@yumsrv pluginconf.d]# vi rhnplugin.conf

[main]
enables=0
gpgcheck=0

[rhel-i386-server-5]
enabled=0

Step-11: Testing the yum server.

Now verify that your Yum is working properly by following this command.

[root@yumsrv ~]# yum clean all
[root@yumsrv ~]# yum update
[root@yumsrv ~]# yum list

Step-11: Testing the yum server.

Now it’s time to testing that our package manager is working properly by type system-config-packages into your terminal window if everything is ok then it will show the package manager as like below.

[root@yumsrv ~]# system-config-packages



Now select a category from left window such as Server and select the packages from right panel that you want to install then click Apply. It will install the core packages and also the related dependent packages. This way you can solve the dependencies installation problem.

Now you can download/install/update packages via internet and also DVD source using yum & package manager.

1 comments:

  1. thank you this article.
    I am sharing this article in tuts publication network -> http://tutpub.com/

    ReplyDelete