How To Install YUM Server In Redhat(RHEL5)

In linux you can install packages through many ways like.
1. Through RPM,
2. Through shell script
3. Through source tar balls etc.

YUM(Yellow-dog Updater and Modifier) is another and advanced way of installing the packages in Linux distros such as Red-hat, Fedora.

In RHEL4 installing packages is a tedious process, some times its headache to install all the dependencies. So Red-hat people come with a solution to overcome this problem in most situations, i.e. nothing but YUM implementation which will resolve this dependency issue. Here I am going to present some basic way how to use YUM utility to install packages locally(there are so many ways to install packages from different sources such as ftp, http etc). You can get the full details about YUM in my google docs here. One Two Three Four Five Six Seven Eight Nine Ten

Basic YUM implementation locally:
Step1 : Copy the entire OS cd's content to Hard-drive as below.

#cp -ar /media/cdrom/* /destinationfolder

Example : #cp -ar /media/cdrom/* /var/ftp/pub

Note :

1. From second cd on words no need to copy entire cd contents to drive just copy Server content in to drive.

2. Here please take destination folder as /var/ftp/pub so that we can implement FTP server to share our reposatory.

3. If you have RHEL5 DVD then just continue with second step.

#cp -ar /media/cdrom/Server/* /var/ftp/pub/Server/

Step2 : Now change the directory to /destinationfolder/Server and install the createrepo package #rpm -ivh createrepo.0.4.4-2 --aid

Step3 : Specify the reposatory location to YUM.

#createrep -v /destinationfolder/

Step4 : Create a file with repo as extention and specify the YUM details in /etc/yum.repos.d folder

#cd /etc/yum.repos.d/ #vi testing.repo

Note : The directory /etc/yum.repos.d/ contaions two .repo files which should be moved or removed to other directory, so that YUM server will check default .repo file it self. The new file which is created contains as follows

[station1.example.com]

comment ="test"

baseurl=file:///destinationfolder

gpgcheck=0

After entring these entries save and exit from the file.

Let me explain what acutally this four entries mean.

[station1.example.com] ==>This informs what is the reposatory name.

Comment ==> Its used to see the inforamtion about the repo.

Baseurl ==> This is the server and path of the repo(here its a local repo so the base url is just a file:///

For example you are creating YUM server through FTP then base url should be like this

baseurl=ftp://station1.example.com/pub/Server gpgcheck ==> This is to check the authentication of the repository, which is disabled in this case.

Local YUM repository is created, now you can install any package you want with yum command. In order to know more about YUM, Please see man pages for YUM.

Basic YUM Server Reposatory through FTP server :
So what about Installing packages remotly by using this reposatory?

Let us see how to configure client to access this repository. Before doing client configuration we have to share this reposatory through FTP or HTTP.

Step1 : Install vsftpd server on server

#yum install vsftpd

Step2 : Start the ftp service and on it

#service vsftpd restart

#chkconfig vsftpd on

Thats it on the server side every thing configured properly, Now move on to client machine Confugration on client side :

Step3 : Remove/move the local reposatory file from /etc/yum.repo.d/ folder to some other location #mv /etc/yum.repo.d/* /safe-loc/

Step4 : Create server.repo file in /etc/yum.repo.d/ with following contents [station1.example.com]

comment ="test"

baseurl=ftp://station1.example.com/pub/Server

gpgcheck=0

Save and exit the file Now start using yum to install packages, as follows.

#yum install packagename

Example : #yum install httpd

To uninstall a package through YUM

#yum remove httpd

To see the info of a package

#yum info packagename

To see the package is already installed or not

#rpm -qa grep packagename

No comments:

Post a Comment