Thursday, September 18, 2008

Installing Yum On RHEL 4

I have RHEL ES 4 at my office. It irritated me terribly as the machine was never updated and hence having very old versions of softwares. Therefore I decided to upgrade my RHEL ES 4 using yum.



From my work place, internet is only accessible through http proxy, that too with authentication. I tried using up2date by creating an account at redhat's site but it didn’t work( I thought you could update one machine using your redhat account).


The first problem I encountered was that there is no public repository to update RHEL machines i.e you have to pay for it. After googling for a while I discovered that CentOS offers public repositories and they work with RHEL 4 as well.



I downloaded latest yum rpm, installed it and configured it to use centOS repo. Every time I ran yum, it failed. It couldn’t find repomd.xml file in the CentOS repositories I provided in yum.conf.


After struggling for some time, I discovered that I was accessing older version of repos through the latest yum. Therefore I had to use an older version of yum with RHEL 4, since old repos do not support xml based updating.



Now I have a fully updated system. Following is the brief summary of the steps I took:-


1) Since I was behind a proxy I had to export environment variable http_proxy.


2) Downloaded yum-2.0.8-1.noarch.rpm from
http://linux.duke.edu/projects/yum/download/2.0/yum-2.0.8-1.noarch.rpm


3) Installed it using
rpm –i yum-2.0.8-1.noarch.rpm


4) Configured my yum.conf to look like this:


[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1

#base]
#ame=Red Hat Linux $releasever - $basearch - Base
#aseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/$releasever/$basearch/
[base]
name=CentOS-$releasever - Base
baseurl=http://mirror.centos.org/centos/4/os/i386/
gpgcheck=1

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


5) Downloaded the gpg key for CentOS rpm packages from
http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4



6) Imported the key like this:
rpm --import RPM-GPG-KEY-CentOS-4


7) Run “yum –y update”. Now Sit back and enjoy seeing your system being updated.