The example below is with a freshly patched (as of the publish date) Redhat 5.5 system. This can be quite useful for a number of reasons. I borrowed heavily from http://www.unixmen.com/linux-tutorials/documentations-a-howto/213-how-to-jul-convert-rhel-5-to-centos-5, with some changes and tweaks to hopefully make it a little simpler (and even scriptable) process.
We start with a simple Redhat system:
[root@convert-test ~]# uname -a Linux convert-test.5amsolutions.com 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux [root@convert-test ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 5.5 (Tikanga)[root@convert-test ~]#
We then install the CentOS repository GPG Key:
[root@convert-test ~]# rpm --import http://mirror.centos.org/centos/5.4/os/i386/RPM-GPG-KEY-CentOS-5 [root@convert-test ~]#
Next we grab the CentOS repo RPMs
[root@convert-test ~]# wget http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/centos-release-5-5.el5.centos.x86_64.rpm --2010-07-27 12:25:09-- http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/centos-release-5-5.el5.centos.x86_64.rpm Resolving mirror.centos.org... 64.131.83.114 Connecting to mirror.centos.org|64.131.83.114|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 19678 (19K) [application/x-rpm] Saving to: `centos-release-5-5.el5.centos.x86_64.rpm' 100%[====================================================================================================================================================================================================================================>] 19,678 --.-K/s in 0.02s 2010-07-27 12:25:10 (818 KB/s) - `centos-release-5-5.el5.centos.x86_64.rpm' saved [19678/19678] [root@convert-test ~]# http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/centos-release-notes-5.5-0.x86_64.rpm -bash: http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/centos-release-notes-5.5-0.x86_64.rpm: No such file or directory [root@convert-test ~]# wget http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/centos-release-notes-5.5-0.x86_64.rpm --2010-07-27 12:25:23-- http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/centos-release-notes-5.5-0.x86_64.rpm Resolving mirror.centos.org... 64.131.83.114 Connecting to mirror.centos.org|64.131.83.114|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 40425 (39K) [application/x-rpm] Saving to: `centos-release-notes-5.5-0.x86_64.rpm' 100%[====================================================================================================================================================================================================================================>] 40,425 --.-K/s in 0.05s 2010-07-27 12:25:24 (827 KB/s) - `centos-release-notes-5.5-0.x86_64.rpm' saved [40425/40425]
After that we pull in the CentOS version of YUM:
[root@convert-test ~]# wget http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm --2010-07-27 12:25:59-- http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/yum-3.2.22-26.el5.centos.noarch.rpm Resolving mirror.centos.org... 64.131.83.114 Connecting to mirror.centos.org|64.131.83.114|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1026405 (1002K) [application/x-rpm] Saving to: `yum-3.2.22-26.el5.centos.noarch.rpm' 100%[====================================================================================================================================================================================================================================>] 1,026,405 383K/s in 2.6s 2010-07-27 12:26:02 (383 KB/s) - `yum-3.2.22-26.el5.centos.noarch.rpm' saved [1026405/1026405] [root@convert-test ~]# wget http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/yum-updatesd-0.9-2.el5.noarch.rpm --2010-07-27 12:26:29-- http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/yum-updatesd-0.9-2.el5.noarch.rpm Resolving mirror.centos.org... 74.53.10.146 Connecting to mirror.centos.org|74.53.10.146|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 22666 (22K) [application/x-rpm] Saving to: `yum-updatesd-0.9-2.el5.noarch.rpm' 100%[====================================================================================================================================================================================================================================>] 22,666 --.-K/s in 0.03s 2010-07-27 12:26:29 (862 KB/s) - `yum-updatesd-0.9-2.el5.noarch.rpm' saved [22666/22666] [root@convert-test ~]# wget http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm --2010-07-27 12:33:19-- http://mirror.centos.org/centos/5.5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm Resolving mirror.centos.org... 67.212.81.83 Connecting to mirror.centos.org|67.212.81.83|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 19145 (19K) [application/x-rpm] Saving to: `yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm' 100%[====================================================================================================================================================================================================================================>] 19,145 92.1K/s in 0.2s 2010-07-27 12:33:20 (92.1 KB/s) - `yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm' saved [19145/19145]
The next step is to remove a few key RPMs from the redhat install:
[root@convert-test ~]# rpm -e --nodeps redhat-release [root@convert-test ~]# rpm -e yum-rhn-plugin rhn-client-tools rhn-check rhn-setup rhnsd warning: /etc/sysconfig/rhn/up2date saved as /etc/sysconfig/rhn/up2date.rpmsave [root@convert-test ~]#
After that we shoe-horn in our CentOS version of YUM:
[root@convert-test ~]# ll total 1172 -rw------- 1 root root 1032 Jul 27 11:31 anaconda-ks.cfg -rw-r--r-- 1 root root 19678 Apr 26 19:40 centos-release-5-5.el5.centos.x86_64.rpm -rw-r--r-- 1 root root 40425 Apr 26 19:40 centos-release-notes-5.5-0.x86_64.rpm -rw-r--r-- 1 root root 19327 Jul 27 11:31 install.log -rw-r--r-- 1 root root 2937 Jul 27 11:31 install.log.syslog -rw-r--r-- 1 root root 1026405 Apr 26 19:42 yum-3.2.22-26.el5.centos.noarch.rpm -rw-r--r-- 1 root root 19145 Jan 18 2010 yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm -rw-r--r-- 1 root root 22666 Jun 14 2008 yum-updatesd-0.9-2.el5.noarch.rpm [root@convert-test ~]# rpm -Uvh --force *.rpm Preparing... ########################################### [100%] 1:centos-release-notes ########################################### [ 20%] 2:centos-release ########################################### [ 40%] 3:yum ########################################### [ 60%] 4:yum-fastestmirror ########################################### [ 80%] 5:yum-updatesd ########################################### [100%]
Then we patch our system with our new YUM (and without the RHN):
[root@convert-test ~]# yum update Loaded plugins: fastestmirror, security Determining fastest mirrors * addons: mirror.rackspace.com * base: mirror.ash.fastserv.com * extras: mirror.team-cymru.org * updates: mirror.team-cymru.org addons | 951 B 00:00 addons/primary | 204 B 00:00 base | 2.1 kB 00:00 base/primary_db | 2.1 MB 00:02 extras | 2.1 kB 00:00 extras/primary_db | 226 kB 00:00 updates | 1.9 kB 00:00 updates/primary_db | 443 kB 00:00 Skipping security plugin, no data Setting up Update Process Resolving Dependencies Skipping security plugin, no data --->; Running transaction check ---> Package Deployment_Guide-en-US.noarch 0:5.2-11.el5.centos set to be updated ---> Package anacron.x86_64 0:2.3-45.el5.centos set to be updated ---> Package basesystem.noarch 0:8.0-5.1.1.el5.centos set to be updated ---> Package bluez-utils.x86_64 0:3.7-2.2.el5.centos set to be updated ---> Package firstboot-tui.x86_64 0:1.4.27.8-1.el5.centos set to be update ---> Package initscripts.x86_64 0:8.45.30-2.el5.centos set to be updated ---> Package kudzu.x86_64 0:1.2.57.1.24-1.el5.centos set to be updated ---> Package man-pages.noarch 0:2.39-15.el5_4 set to be updated ---> Package pango.i386 0:1.14.9-8.el5.centos set to be updated ---> Package pango.x86_64 0:1.14.9-8.el5.centos set to be updated ---> Package pax.x86_64 0:3.4-2.el5_4 set to be updated ---> Package pciutils.x86_64 0:2.2.3-8.el5_4 set to be updated ---> Package pm-utils.x86_64 0:0.99.3-10.el5.centos set to be updated ---> Package procmail.x86_64 0:3.22-17.1.el5.centos set to be updated ---> Package redhat-logos.noarch 0:4.9.99-11.el5.centos set to be updated ---> Package redhat-lsb.i386 0:3.1-12.3.EL.el5.centos set to be updated ---> Package redhat-lsb.x86_64 0:3.1-12.3.EL.el5.centos set to be updated ---> Package setuptool.x86_64 0:1.19.2-1.el5.centos set to be updated ---> Package specspo.noarch 0:13-1.el5.centos set to be updated ---> Package yum-metadata-parser.x86_64 0:1.1.2-3.el5.centos set to be updated ---> Package yum-security.noarch 0:1.1.16-14.el5.centos.1 set to be updated addons/filelists | 197 B 00:00 base/filelists_db | 4.0 MB 00:05 extras/filelists_db | 220 kB 00:00 updates/filelists_db | 1.4 MB 00:02 > Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================================================================================== Package Arch Version Repository Size ============================================================================================================================================================================================================================================================================== Updating: Deployment_Guide-en-US noarch 5.2-11.el5.centos base 3.5 M anacron x86_64 2.3-45.el5.centos base 36 k basesystem noarch 8.0-5.1.1.el5.centos base 2.8 k bluez-utils x86_64 3.7-2.2.el5.centos base 358 k firstboot-tui x86_64 1.4.27.8-1.el5.centos base 189 k initscripts x86_64 8.45.30-2.el5.centos base 1.6 M kudzu x86_64 1.2.57.1.24-1.el5.centos base 220 k man-pages noarch 2.39-15.el5_4 base 4.2 M pango i386 1.14.9-8.el5.centos updates 335 k pango x86_64 1.14.9-8.el5.centos updates 339 k pax x86_64 3.4-2.el5_4 base 63 k pciutils x86_64 2.2.3-8.el5_4 base 83 k pm-utils x86_64 0.99.3-10.el5.centos base 134 k procmail x86_64 3.22-17.1.el5.centos base 172 k redhat-logos noarch 4.9.99-11.el5.centos base 26 M redhat-lsb i386 3.1-12.3.EL.el5.centos base 21 k redhat-lsb x86_64 3.1-12.3.EL.el5.centos base 21 k setuptool x86_64 1.19.2-1.el5.centos base 51 k specspo noarch 13-1.el5.centos base 6.0 M yum-metadata-parser x86_64 1.1.2-3.el5.centos base 25 k yum-security noarch 1.1.16-14.el5.centos.1 base 25 k Transaction Summary ============================================================================================================================================================================================================================================================================== Install 0 Package(s) Upgrade 21 Package(s) Total download size: 44 M Is this ok [y/N]:
After we do that we reboot the VM to make sure all is well:
[root@convert-test ~]# shutdown -r now Broadcast message from root (pts/0) (Tue Jul 27 12:40:51 2010): The system is going down for reboot NOW! [root@convert-test ~]# Connection to 192.168.75.131 closed by remote host.And after the reboot... we have a CentOS server![root@convert-test ~]# cat /etc/redhat-release CentOS release 5.5 (Final) [root@convert-test ~]# yum check-update Loaded plugins: fastestmirror, security Loading mirror speeds from cached hostfile * addons: mirror.rackspace.com * base: mirror.ash.fastserv.com * extras: mirror.team-cymru.org * updates: mirror.team-cymru.org Skipping security plugin, no data [root@convert-test ~]# uname -a Linux convert-test.5amsolutions.com 2.6.18-194.8.1.el5 #1 SMP Wed Jun 23 10:52:51 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
0 comments:
Post a Comment