How to Upgrade/Migrate a Red Hat Linux 4 to cent OS(4.9)

To Upgrade/Migrate a Red Hat Linux 4 to cent OS(4.9) follow the stepby step Guide.

Firstly, do a cleanup:

yum clean all

Then, create a working space where RPMs can be downloaded:

mkdir ~/centos
cd ~/centos

Now download the relevant CentOS key and import it:

wget http://vault.centos.org/4.9/os/x86_64/RPM-GPG-KEY-centos4
rpm –import RPM-GPG-KEY-centos4

Then, get relevant packages from CentOS – note these instructions will pull i386 packages or x86_64 packages depending on your system:

wget http://vault.centos.org/4.9/os/x86_64/CentOS/RPMS/centos-release-4-8.x86_64.rpm

wget http://vault.centos.org/4.9/os/x86_64/CentOS/RPMS/yum-2.4.3-4.el4.centos.noarch.rpm

wget http://vault.centos.org/4.9/os/x86_64/CentOS/RPMS/yum-metadata-parser-1.0 8.el4.centos.x86_64.rpm

 

wget http://vault.centos.org/4.9/os/x86_64/CentOS/RPMS/python-elementtree-1.2.6-5.el4.centos.x86_64.rpm

 

wget http://vault.centos.org/4.9/os/x86_64/CentOS/RPMS/python-sqlite-1.1.7-1.2.1.x86_64.rpm

 

wget http://vault.centos.org/4.9/os/x86_64/CentOS/RPMS/python-urlgrabber-2.9.8-2.noarch.rpm

 

wget http://vault.centos.org/4.9/os/x86_64/CentOS/RPMS/python-sqlite-1.1.7-1.2.1.x86_64.rpm

 

wget http://vault.centos.org/4.9/os/x86_64/CentOS/RPMS/sqlite-3.3.6-2.x86_64.rpm

 

wget http://vault.centos.org/4.9/os/x86_64/CentOS/RPMS/sqlite-devel-3.3.6-2.x86_64.rpm

 

If you don’t want to use wget other option is to connect using elinks to connect to CentOS repository.

Using elinks allows you to get the most recent version without stumbling over the version number – if the package is updated, you don’t have to guess at the version numbers in the filename.

elinks http://vault.centos.org/4.9/os/x86_64/CentOS/RPMS/

 

Now update all of the packages that were downloaded:

rpm -Uvh –force *.rpm

warning: centos-release-4-8.x86_64.rpm: V3 DSA signature: NOKEY, key ID 443e1821

Preparing…                ########################################### [100%]

Repackaging…

1:redhat-release         ########################################### [100%]

Upgrading…

1:sqlite                 ########################################### [ 13%]

2:python-sqlite          ########################################### [ 25%]

3:yum-metadata-parser    ########################################### [ 38%]

4:python-elementtree     ########################################### [ 50%]

5:python-urlgrabber      ########################################### [ 63%]

6:centos-release         ########################################### [ 75%]

7:sqlite-devel           ########################################### [ 88%]

8:yum                    warning: /etc/yum.conf created as /etc/yum.conf.rpmnew

########################################### [100%]

 

 

Ensure that in your “/etc/yum.repos.d/” directory there are not “redhat” related files, If found remove them.

Copy over the yum.conf which was renamed during installation.

 

cp –p /etc/yum.conf.rpmnew /etc/yum.conf

 

Edit /etc/yum.repos.d/CentOS-Base.repo and replace base and update repos entries as below:

[base]

name=CentOS-$releasever – Base

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

#mirrorlist=http://vault.centos.org/?release=$releasever&arch=$basearch&repo=os

#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/

baseurl=http://vault.centos.org/4.9/os/$basearch

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

priority=1

protect=1

 

#released updates

[update]

name=CentOS-$releasever – Updates

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

#mirrorlist=http://vault.centos.org/?release=$releasever&arch=$basearch&repo=updates

#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/

baseurl=http://vault.centos.org/4.9/updates/$basearch

gpgcheck=1

#gpgkey=http://vault.centos.org/centos/RPM-GPG-KEY-centos4

gpgkey=http://vault.centos.org/4.0/os/x86_64/RPM-GPG-KEY-centos4

priority=1

protect=1

#packages used/produced in the build but not released

[addons]

name=CentOS-$releasever – Addons

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons

#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

priority=1

enabled=0

protect=1

 

#additional packages that may be useful

[extras]

name=CentOS-$releasever – Extras

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/

enabled=0

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

priority=1

protect=1

 

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever – Plus

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

priority=2

protect=1

 

#contrib – packages by Centos Users

[contrib]

name=CentOS-$releasever – Contrib

mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib

#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4

priority=2

protect=1

 

Lastly, perform an upgrade to fully update the system from the new CentOS repositories:

yum upgrade

This will upgrade the server to cent OS 4.9.

 

For best practices, you probably should reboot here as well – thus loading new libraries, deleting old files, and activating right kernel.

 

Once server is rebooted ensure that we have restored back the perl softlink as it gets removed after conversion.