Configuring Local Yum Server on RHEL 5.x (Part-2)

Package manager:

All software on a Red Hat Enterprise Linux system is divided into RPM packages which can install, upgrade, or remove. In my previous tutorial I have described that how to use yum as a command line tools for downloading and installing packages. But it is also possible to do all this things using package manager, actually a package manager is graphical tools for Installing/Removing Packages, which is similar to the Add/Remove program of windows. But from Red Hat Enterprise Linux 5 it is difficult to install/remove packages using package manager due to its dependencies problem. To install/remove packages using package manager by solving dependencies problem follow the following steps to enable the package manager.

Server Side Configuration

You can configure package manager to use in local machine or remote machine on your network. You can also do this using internet that you will show on my next tutorial. If you have more than one computer which are running Linux operating system first configure a server system where all the repositories will store then install and configure httpd/vsftpd services for client machine accessing, that I have already been discussed in my previous tutorial (Part-1).

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
Warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing…
########################################### [100%]
1:createrepo
########################################### [100%]

 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 into /var/www/html/ named “rhel5” which will act as a mount point directory for this ISO.  If you are wish to provide http services for client accessing then it will be the default directory for http services, but if you are using ftp services for client accessing then the default directory will be /var/ftp/pub, for ftp services put your all the DVD resources in this directory. Otherwise if you are wish to use it only local machine then choose any location in your local machine.

[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 following 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

[main]
gpgcheck=0
plugins=0

[Base]
name=Red Hat Enterprise Linux Local Repository
baseurl=file:///var/www/html/rhel5
enabled=1
gpgcheck=0
gpgkey=file:///var/www/html/rhel5/RPM-GPG-KEY-redhat-release

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

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

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

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

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]# cp rhel-debuginfo.repo  rhel5.repo
[root@yumsrv yum.repos.d]# vi rhel5.repo

RHEL5-Debuginfo]
name= Red Hat Enterprise Linux Local Repository Debuginfo
baseurl= file:///var/www/html/rhel5
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Note: Remove or move the rhel-debuginfo.repo file, otherwise yum will try to use this file.

Step-10: Disable RHN Plug-ins.

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

[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. You can also start the application; go to Applications (the main menu on the panel) → Add/Remove Software.

[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.

Prepare Server for Client machine:

If you want to provide client machine to download & install the packages via package manager, then you will have to enable following services below on your Server Machine. In this case I am describing both of them, but in real world you can configure one of them.

  • By Enabling HTTP Services
  • By Enabling FTP Services

 Enabling HTTP Services in Yum Server

Step-1: Install httpd RPM package

[root@yumsrv ~]# yum install httpd* -y

Step-2:  Configuring the httpd.conf file.

Step-3:  Restart all the required services

[root@yumsrv ~]# service httpd restart
[root@yumsrv ~]# chkconfig httpd on

HTTP Client configuration

Step-1:  Locating repository information

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

[main]
gpgcheck=0
plugins=0

[Base]
name=Red Hat Enterprise Linux Local Repository
baseurl=http://210.207.201.254/rhel5
enabled=1
gpgcheck=0
gpgkey=http://210.207.201.254/rhel5/RPM-GPG-KEY-redhat-release

[Server]
name=rhel5-Server
baseurl=http://210.207.201.254/rhel5/Server/
enabled=1

[Cluster]
name=rhel5-Cluster
baseurl=http://210.207.201.254/rhel5/Cluster/
enabled=1

[ClusterStorage]
name=rhel5-ClusterStorage
baseurl=http://210.207.201.254/rhel5/ClusterStorage/
enabled=1

[VT]
name=rhel5-Virtualization
baseurl=http://210.207.201.254/rhel5/VT/
enabled=1

Step-2:  Locating debug information

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

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

RHEL5-Debuginfo]
name= Red Hat Enterprise Linux Local Repository Debuginfo
baseurl= http://210.207.201.254/rhel5
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Step-3:  Disable RHN plug-ins

Step-4:  Editing hosts file

[root@pc1 ~]# vi /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
210.207.201.254 yumsrv     yumsrv
210.207.201.x   pc1        pc1

Step-5:  Test the Configuration.

Now verify that your client can download and install packages from yum server by typing the command below.

[root@pc1 ~]# yum clean all
[root@pc1 ~]# yum update
[root@pc1 ~]# yum list
[root@pc1 ~]# system-config-packages

So now you can install/remove the packages using packages manager from your client machine by with the help of local http server.

Enabling FTP Services in Server

If you are wish to use ftp services for client accessing then put the DVD resources into /var/ftp/pub/ directory.

 Step-1:  Installing the ftp package

[root@yumsrv ~]# yum install vsftpd* -y

Step-2:  Edit the vsftpd.conf file

Step-3:  Restart all the required services

[root@yumsrv ~]# service iptables stop
[root@yumsrv ~]# chkconfig iptables off
[root@yumsrv ~]# service network restart
[root@yumsrv ~]# service vsftpd restart
[root@yumsrv ~]# chkconfig vsftpd on

Client side configuration

Follow the “HTTP Client configuration” Just replacehttp://210.207.201.254/rhel5” With ftp://210.207.201.254/pub/rhel5. Also configure the “/etc/hosts” file.

Step-1:  Locating repository information

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

[main]
gpgcheck=0
plugins=0

[Base]
name=Red Hat Enterprise Linux Local Repository
baseurl=ftp://210.207.201.254/pub/rhel5
enabled=1
gpgcheck=0
gpgkey=ftp://var/ftp/pub/rhel5/RPM-GPG-KEY-redhat-release

[Server]
name=rhel5-Server
baseurl=ftp://210.207.201.254/pub/rhel5/Server/
enabled=1

[Cluster]
name=rhel5-Cluster
baseurl=ftp://210.207.201.254/pub/rhel5/Cluster/
enabled=1

[ClusterStorage]
name=rhel5-ClusterStorage
baseurl=ftp://210.207.201.254/pub/rhel5/ClusterStorage/
enabled=1

[VT]
name=rhel5-Virtualization
baseurl=ftp://210.207.201.254/pub/rhel5/VT/
enabled=1

Step-2:  Locating 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]# cp rhel-debuginfo.repo  rhel5.repo
[root@yumsrv yum.repos.d]# vi rhel5.repo

RHEL5-Debuginfo]
name= Red Hat Enterprise Linux Local Repository Debuginfo
baseurl= ftp://210.207.201.254/pub/rhel5
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Step-3:  Disable RHN plug-ins

Step-4:  Test the Configuration.

Now verify that your client can download and install packages from yum server by typing the command below.

[root@pc1 ~]# yum clean all
[root@pc1 ~]# yum update
[root@pc1 ~]# yum list
[root@pc1 ~]# system-config-packages

So now you can install/remove the packages using packages manager from your client machine by with the help of local ftp server.

Author Info

Md. Kamrul Hassan

Myself is a Computer Network Specialist. Working in a training center (name - Acme IT) in Bangladesh. Basically most of the tutorial I have written here is created for my students. Happy to know if it become useful for visitors. You can find me at Facebook