How to Configure YUM repository in RHEL 5

Installing packages and configuring Servers we need to configure the YellowDog Update Manager (YUM)
First,

1 If its local repository then
------------------------------------------------------------------------------------------
Install Package createrepo ( this pacakge is present in RHEL 5 dvd in Server folder)

RPM -ivh createrepo

createrepo -v /var/ftp/pub/Server


/var/ftp/pub/Server => this is the directory where local copy of RPM packages are there

Edit the Server.repo file
# vi Server.repo
[Server]
name= redhat
baseurl=file://
/var/ftp/pub/Server
[enable=1]
[gpgcheck=0]

Save the file and quit
Then,
#yum clean all
#yum update

Now you can install packages
#yum install package-name



-----------------------------------------------------------------------------------------------
Computer Training
2 If repository is present in server
-----------------------------------------------------------------------------------------------
#cd /etc/yum.repos.d
#ls

Then it will list the files. There is a file with name rhel-debuginfo.repo. Copy this file to a temp file with name Sever.repo. The starting letter of Server should be Capital.
Second step is given below

#cp rhel-debuginfo.repo Server.repo
The Third and final steps
Edit the Server.repo file
# vi Server.repo
[Server]
[name= redhat]
[baseurl=ftp://192.168.0.254/pub/Server] ( eg: IP address : 192.168.0.254 (the server IP)
[enable=1]
[gpgcheck=0]

Save the file and quit
Then,
#yum clean all
#yum update

Now you can install packages
#yum install package-name


Configuring YUM behind the HTTP proxy

Under Normal Conditions yum dont work if you are suing internet behind proxy


So in yum.conf add
#The proxy server or IP address:port number


proxy=http://proxy.server.com:8080


Below one if you use ( username/password)


proxy_username=userid
proxy_password=password









-----------------------------------------------------------------------------------------------

Other topics you may find intresting
Linux Interview Questions basic 
Important Port numbers of linux asked in interview 
Linux Advance interview Questions 
Oracle DBA interview Questions

Configure Nagios from scratch

14 comments:

Anonymous said...

I am using local disk repository, but getting this error..
"
This is system is not registered with rhn,
Rhn support is disabled,......"

Naresh Surampudi said...

can you give full error details ??

are you getting Error 2 file doesnot exists etc ??
like

[error 5]OSError
[error 2]No such file or direcotry

if you are gettign that error xml file doesnot exists so check it

niks said...

how to create yum repository with mirror.....when i create local yum repository..so error setting up local process..

Anonymous said...

Go to http://mirrors.fedoraproject.org/mirrorlists/publiclist/Fedora/8, find a mirror that offers rsync, and download the packages as follows (this can take a long time so be patient):

rsync -avrt rsync://ftp-stud.hs-esslingen.de/fedora/linux/releases/8/Everything/i386/os/Packages/ /var/www/html/yum/base/8/i386

(Please make sure you use all slashes (/) as shown above - it must be rsync://ftp-stud.hs-esslingen.de/fedora/linux/releases/8/Everything/i386/os/Packages/, not rsync://ftp-stud.hs-esslingen.de/fedora/linux/releases/8/Everything/i386/os/Packages!)

Afterwards, run the createrepo command:

createrepo /var/www/html/yum/base/8/i386

This will create a repodata directory in the /var/www/html/yum/base/8/i386 directory. Its contents should be as follows:

ls -l /var/www/html/yum/base/8/i386/repodata/

[root@server1 /]# ls -l /var/www/html/yum/base/8/i386/repodata/
total 9268
-rw-r--r-- 1 root root 2227275 2007-12-18 21:11 filelists.xml.gz
-rw-r--r-- 1 root root 6487453 2007-12-18 21:11 other.xml.gz
-rw-r--r-- 1 root root 747714 2007-12-18 21:11 primary.xml.gz
-rw-r--r-- 1 root root 951 2007-12-18 21:11 repomd.xml
[root@server1 /]#

Anonymous said...

To create the repostiory, has to install an rpm createrepo using rpm command.

[root@redhat5 /]# rpm ivh /public/repo/createrepo-0.4.4-2.fc6.noarch.rpm

Now create the repo uning createrepo command.

[root@redhat5 /]# createrepo /public/repo

2179/2179 - libevent-1.1a-3.2.1.i386.rpm m

Saving Primary metadata

Saving file lists metadata

Saving other metadata

Our repo server is ready and now in clients we can add the entry for our new repo. Yum repo entries are added in /etc/yum.repos.d/rhel-debuginfo.repo. It already carries entry for the RedHat ftp repository. We may add one more entry for our repo and disable RedHat repo.

[root@redhat5 ~]# vim /etc/yum.repos.d/rhel-debuginfo.repo

[rhel-debuginfo]

name=Red Hat Enterprise Linux $releasever - $basearch - Debug

baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Anonymous said...

[rhel]

name=Red Hat Enterprise Linux $releasever - $basearch - Debug

baseurl=ftp://172.16.1.22

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Here the ftp://ipaddress refers to the anonymous root of ftp server which is our repo directory. If the anonymous root is /var/ftp and repo directory is /var/ftp/pub/repo, then thebaseurl will be ftp://172.16.1.22/pub/repo.
Now the server and clients are ready and let test it with xinetd installation.

[root@redhat5 ~]# rpm -q xinetd

package xinetd is not installed

[root@redhat5 ~]# yum install xinetd

Loading "installonlyn" plugin

Loading "rhnplugin" plugin

This system is not registered with RHN.

RHN support will be disabled.

Setting up Install Process

Anonymous said...

Setting up repositories

rhel 100% |=========================| 951 B 00:00

Reading repository metadata in from local files

primary.xml.gz 100% |=========================| 751 kB 00:00

################################################## 2178/2178

Parsing package install arguments

Resolving Dependencies

--> Populating transaction set with selected packages. Please wait.

---> Downloading header for xinetd to pack into transaction set.

xinetd-2.3.14-10.el5.i386 100% |=========================| 7.7 kB 00:00

---> Package xinetd.i386 2:2.3.14-10.el5 set to be updated

--> Running transaction check



Dependencies Resolved



=============================================================================

Package Arch Version Repository Size

=============================================================================

Installing:

xinetd i386 2:2.3.14-10.el5 rhel 124 k

Anonymous said...

Transaction Summary

=============================================================================

Install 1 Package(s)

Update 0 Package(s)

Remove 0 Package(s)



Total download size: 124 k

Is this ok [y/N]: y

Downloading Packages:

(1/1): xinetd-2.3.14-10.e 100% |=========================| 124 kB 00:00

warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 37017186

Importing GPG key 0x37017186 "Red Hat, Inc. (release key) "

Is this ok [y/N]: y

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing: xinetd ######################### [1/1]



Installed: xinetd.i386 2:2.3.14-10.el5

Complete!

[root@redhat5 ~]#


After adding rpm files to repo directory, createrepo has to be run to recreate the rpm data base.

* Install rpm :-

yum install rpmname

* Remove rpm:-

yum remove rpmname

* List available rpms

yum list rpmname
or
yum list name*

* Clear rpm database in local machine

yum clean all

* List information regarding one rpm

yum info rpmanme

krishna said...

can u plz tell me the how to configure a yum client so that it can be possible to install the RPMs on client through yum server

krishna said...

i've configure a yum server. the rhl dvd directory is /var/ftp/pub
i've shared this directory through nfs

vipinkumarr89 said...
This comment has been removed by the author.
vigrem said...

if I configure Cent OS opensource repository for Redhat EL version will it support and can I update & download from there ...

can u pls let me know

Arvind(Schumacher) said...

While trying to install yum repository i am getting error

/usr/bin/python: error while loading shared libraries: libpython2.4.so.1.0: cannot open shared object file: No such file or directory

Any help or advice on what needs to be done so i can proceed..

Naresh Surampudi said...

install python-libs rpm