Due to a change in our school’s licensing, I’m tasked with switching some of our CentOS 5 servers to Red Hat Enterprise Linux. While there’s a number of guides on how to switch to CentOS, it’s not quite as obvious on how to switch back.
At a minimum, you want to:
- Add the RHEL-specific RPMs for yum.
- Reconfigure packages to use “5Server” as the base OS version, instead of “5.”
- Register the computer with the Red Hat Network.
Locate the Red Hat RPMs
Unlike with CentOS and its public repository, the required Red Hat RPMs are located on the installation media. Luckily, anyone with a RHN license should have access to the Red Hat download center, which contains the media as ISOs. Download the 5.3 ISO for your CPU architecture (i386, x85_64, etc), as this seems to most closely match the CentOS 5 RPMs.
mkdir -p /mnt/cdrom mount -o loop rhel-server-5.3-x86_64-dvd.iso /mnt/cdrom
Of course, change this to whatever name you may have given the downloaded ISO. If you are converting multiple machines, you may find it handy to copy the RPMs to an internal website, rather than mounting the ISO on each host in question, but that’s out of the scope of this post.
Remove the CentOS Release RPMs
These RPMs provide the $releasever information used by several utilities, along with the defaul /etc/issue and other “branded” files. However, they need to be removed before installing the RHEL equivalent RPMs.
rpm -e --nodeps centos-release centos-release-notes
Add the Red Hat Release RPMs
Remember to point to whevever you mounted the ISO, or copied the RPMs.
cd /mnt/cdrom/Server rpm -Uvh redhat-release-5Server-5.3.0.3.x86_64.rpm \ redhat-release-notes-5Server-25.x86_64.rpm
Add the RHN-related RPMS
cd /mnt/cdrom/Server rpm -Uvh rhn-check-0.4.19-17.el5.noarch.rpm \ rhn-client-tools-0.4.19-17.el5.noarch.rpm \ rhnsd-4.6.1-1.el5.x86_64.rpm \ rhn-setup-0.4.19-17.el5.noarch.rpm \ rhnlib-2.2.6-2.el5.noarch.rpm \ yum-rhn-plugin-0.5.3-30.el5.noarch.rpm \ pyOpenSSL-0.6-1.p24.7.2.2.x86_64.rpm
Register the host with RHN
At this point, you can either use the GUI, or command-line.
rhnreg_ks –user <RHN-user> –pass <RHN-pass>
Ensure Channel Subscription
Ensure you’re connected to the correct channel. You may need to visit the RHN website to add any additional entitlement channels at this time.
yum repolist
Apply Waiting Updates
At this point, we’re running an out-of-date RHEL 5.3 system. You’ll want to patch it and reboot. Expect over 200 packages, and make sure you have 250+ megabytes of disk space for the patch download. Also, make sure you say “yes” to import the Red Hat GPG key.
yum update reboot
VMware and other kernel-related packages may fail to load, but you should be able to update them after the reboot. However, this is outside the scope of this post. Find and install any updates for these kernel packages to fix those errors.
Post-Reboot
Remove any CentOS-specific yum plugins.
yum erase yum-fastestmirror
Do this after the conversion. Else, you may find all your yum-related packages get uninstalled due to the dependency checks.
Comments (0)