Last modified: [last-modified]
This post relates to my older post about converting RHEL 5.x to CentOS 5.x. All the reasons for doing so and other background information can be found in that post.
This post will cover how to convert RHEL 6.x to 5.x.
Updated 2016-03-29 – Thanks to feedback from here I’ve updated the guide.
Updates and Backups!
- Fully patch your system and reboot your system before starting this process
- Take a full backup of your system or a Snapshot if it’s a VM
Conversion
- Login to the server and become root
- Clean up yum’s cache
localhost:~ root# yum clean all
- Create a temporary working area
localhost:~ root# mkdir -p /temp/centos localhost:~ root# cd /temp/centos
- Determine your version of RHEL
localhost:~ root# cat /etc/redhat-release
- Determine your architecture (32-bit = i386, 64-bit = x86_64)
localhost:~ root# uname -i
- Download the applicable files for your release and architecture. The version numbers on these packages could change. To find the current versions of these files browse this FTP site: http://mirror.centos.org/centos/6/os/i386/Packages/ (32-bit) or http://mirror.centos.org/centos/6/os/x86_64/Packages/ (64-bit) and replace the ‘x’ values below with the current version numbers
CentOS 6.5 / 32-bitlocalhost:~ root# wget http://mirror.centos.org/centos/6/os/i386/RPM-GPG-KEY-CentOS-6 localhost:~ root# wget http://mirror.centos.org/centos/6/os/i386/Packages/centos-release-6-x.el6.centos.x.x.i686.rpm localhost:~ root# wget http://mirror.centos.org/centos/6/os/i386/Packages/centos-indexhtml-6-x.el6.centos.noarch.rpm localhost:~ root# wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-x.x.x-x.el6.centos.noarch.rpm localhost:~ root# wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-plugin-fastestmirror-x.x.x-x.el6.noarch.rpm
CentOS 6.5 / 64-bit
localhost:~ root# wget http://mirror.centos.org/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6 localhost:~ root# wget http://mirror.centos.org/centos/6/os/x86_64/Packages/centos-release-6-x.el6.centos.xx.x.x86_64.rpm localhost:~ root# wget http://mirror.centos.org/centos/6/os/x86_64/Packages/centos-indexhtml-6-x.el6.centos.noarch.rpm localhost:~ root# wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-x.x.xx-xx.el6.centos.noarch.rpm localhost:~ root# wget http://mirror.centos.org/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-x.x.xx-xx.el6.noarch.rpm
- Import the GPG key for the appropriate version of CentOS
localhost:~ root# rpm --import RPM-GPG-KEY-CentOS-6
- Remove RHEL packages
Note: If the ‘rpm -e’ command fails saying one of the packages is not installed remove the package from the command and run it again.localhost:~ root# yum remove rhnlib abrt-plugin-bugzilla redhat-release-notes* localhost:~ root# rpm -e --nodeps redhat-release-server-6Server redhat-indexhtml
- Remove any left over RHEL subscription information and the subscription-manager
Note: If you do not do this every time you run ‘yum’ you will receive the following message: “This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.”localhost:~ root# subscription-manager clean localhost:~ root# yum remove subscription-manager
- Force install the CentOS RPMs we downloaded
localhost:~ root# rpm -Uvh --force *.rpm
- Clean up yum one more time and then upgrade
localhost:~ root# yum clean all localhost:~ root# yum upgrade
- Reboot your server
- Verify functionality
- Delete VM Snapshot if you took one as part of the backup
References
- http://knowledgelayer.softlayer.com/procedure/convert-redhat-centos
- http://wiki.centos.org/HowTos/MigrationGuide
- http://community.spiceworks.com/how_to/show/1502-convert-a-rhel5-linux-server-to-a-centos5-server
I’m encountering an error with step 8:
The message is:
I’m not subscribed to RHEL (the reason why I want to switch this VM over to CentOS to begin with). I’m much more familiar with apt/aptitude than yum, but it seems like –skip-broken is non-sequitur for the problem of “no valid mirrors”. And I’m not sure why it wants a mirrorlist anyhow, if I’m removing a package.
Any idea how to get past this message?
Did you get an error on Step 6? Those packages don’t appear to be available anymore. You can get the latest ones by replacing 6.5 with 6.6 in the paths.
That errors sounds to me like the CentOS Repo’s aren’t installed or there is something wrong with your internet connection.
I have tried to attempt this and used neofetch to check the system settings and it shows that the pc goes from RHEL 6 to CentOS6 but im using a vm and when I reboot my system the mount points I have fail to mount. I have one mount point that points to a backup network drive and the other is the OS. Is there anything to check on the HDD before rebooting after making these changes?
No. I’ve done this procedure on multiple servers (physical and virtual) and never had to update anything related to the disks or mount points.
Did you install “centos-release” and “centos-release-notes” and remove the redhat equivalent? It seems to be having an issue with “6server”. This is what Redhat names their servers while CentOS uses just 6. So its looking for a version of CentOS that doesn’t exist.
Yes. It does appear I installed “centos-release-6-5.el6.centos.11.1.x86_64.rpm” according to my documentation.
That means I would have removed what ever rhel-release equiv was on there.
This command should take care of the rhel equivs: “yum remove rhnlib abrt-plugin-bugzilla redhat-release-notes*”
Thank you for this tutorial, followed it and worked great. I had an issue but that was because the CentOS repo was not set up properly and OEL (Oracle Linux) packages were not removed at that time.
You’re welcome!
Stupid question I know, but does this keep the RHEL logos and GRUB entries intact?
No. I believe the entire UI changes over to CentOS.
I do not know what happens to your grub boot loader entries for certain but I imagine they stay the same.
Fair enough, I was just a bit curious since CentOS is so firm about staying within the law even on that point.
Thank you for the guide!
Have you tested this procedure going from RHEL 7 to CentOS 7?
I have not. We haven’t bothered deploying any RHEL7 boxes since we switched to CentOS.
While updating from 6.4 Santiago to CentOS it got updated, but after reboot while using yum update i am getting a lot of missing dependencies. Please suggest.
Sorry but that is not enough information to even begin troubleshooting accurately.
Try a “sudo yum clean all” and a “sudo yum update” and see where that gets you.
Otherwise you could try posting here for help:
https://www.centos.org/forums/viewforum.php?f=13&sid=a6f045b751b8f44ec17a8b01080c0adc
http://serverfault.com/
Hi Eric,
Thanks for the wonderful procedure/tutorial. This helped me a lot in my project.
But after converting RHEL6 to CentOS 6 /boot/grub/grub.conf doesnt appear on system, any idea about that?
Thanks in advance.
Sorry no. That’s strange. I’ve converted over 20 servers and never lost the /boot volume. I’m thinking the issue might be unrelated to the conversion…
You will also need http://mirror.centos.org/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
As it’s a dependency of yum:
error: Failed dependencies:
python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-73.el6.centos.noarch
Odd. Must have been on all of my systems already. Thanks for the tip!
I have another problem. After step 6 I got this error in yum:
[root@KDJkramerius1 TMP]# yum
Zavedeny zásuvné moduly: downloadonly, fastestmirror, product-id, subscription-manager
Traceback (most recent call last):
File “/usr/bin/yum”, line 29, in <module>
yummain.user_main(sys.argv[1:], exit_code=True)
File “/usr/share/yum-cli/yummain.py”, line 298, in user_main
errcode = main(args)
File “/usr/share/yum-cli/yummain.py”, line 115, in main
base.getOptionsConfig(args)
File “/usr/share/yum-cli/cli.py”, line 229, in getOptionsConfig
self.conf
File “/usr/lib/python2.6/site-packages/yum/__init__.py”, line 911, in <lambda>
conf = property(fget=lambda self: self._getConfig(),
File “/usr/lib/python2.6/site-packages/yum/__init__.py”, line 335, in _getConfig
startupconf.pluginconfpath,disabled_plugins,enabled_plugins)
File “/usr/lib/python2.6/site-packages/yum/__init__.py”, line 564, in doPluginSetup
plugin_types, confpath, disabled_plugins, enabled_plugins)
File “/usr/lib/python2.6/site-packages/yum/plugins.py”, line 167, in __init__
self.run(‘config’)
File “/usr/lib/python2.6/site-packages/yum/plugins.py”, line 184, in run
func(conduitcls(self, self.base, conf, **kwargs))
File “/usr/lib/yum-plugins/downloadonly.py”, line 30, in config_hook
default=False, help=”don’t update, just download”)
File “/usr/lib64/python2.6/optparse.py”, line 1020, in add_option
self._check_conflict(option)
File “/usr/lib64/python2.6/optparse.py”, line 995, in _check_conflict
option)
optparse.OptionConflictError: option –downloadonly: conflicting option string(s): –downloadonly
Did you follow all of the steps in step 6? There are multiple RPMS that have to be installed. Also did you do Step 7?
The command you’re showing ‘yum’ doesn’t have any arguments after it like it should in Step 8.
Thanks for this. It simply “just worked” for me. I did have to go back to an older Centos reposity, figuring that the initial transition should be done on the same version of RHEL that I was running. I think that was 6.7 (http://vault.centos.org/6.7/os/x86_64/Packages/). It upgraded to 6.8 automatically, after that, which was fine.
So in summary:
yum -y update
yum clean all
wget http://mirror.centos.org/centos/6/os/x86_64/RPM-GPG-KEY-CentOS-6
wget http://vault.centos.org/6.7/os/x86_64/Packages/centos-release-6-7.el6.centos.12.3.x86_64.rpm
wget http://vault.centos.org/6.7/os/x86_64/Packages/centos-indexhtml-6-2.el6.centos.noarch.rpm
wget http://vault.centos.org/6.7/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm
wget http://vault.centos.org/6.7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
ls -lt *.rpm
rpm –import RPM-GPG-KEY-CentOS-6
yum remove rhnlib abrt-plugin-bugzilla redhat-release-notes*
rpm -e –nodeps redhat-release-server-6Server redhat-indexhtml
yum remove subscription-manager
rpm -Uvh –force *.rpm
yum clean all
yum upgrade
yum update (did nothing)
Glad it still works.
What would need changing to migrate to Scientific Linux instead of centos
Chances are just the repo paths but I honestly don’t know.
I made the change from RH 6.3 to CentOS 6.9. I could not upgrade because the epel repository was giving “[Errno 14] problem making ssl connection”. For this it was necessary to manually update the nss packages (nspr-4.13.1-1.el6.x86_64.rpm
nss-3.27.1-13.el6.x86_64.rpm, nss-softokn-3.14.3-23.3.el6_8.x86_64.rpm, nss-softokn-freebl-3.14.3-23.3.el6_8.x86_64.rpm, nss- sysinit-3.27.1-13.el6.x86_64.rpm,
nss-tools-3.27.1-13.el6.x86_64.rpm, nss-util-3.27.1-3.el6.x86_64.rpm). From there I was able to upgrade.
I forgot to quote the source: http://avz.org.ua/wp/2015/02/25/yum-errno-14-problem-making-ssl-connection/
Thanks for sharing.
Thank you very much for this document.
I have a question for you.
Rpm – import rpm – GPG-key-ROOS-6
If I write a command above,
RPM – GPG-key- –6 : key 1 import failed
An error will occur. What’s the cause?
Are you running the command as root?
At step 6, seems packages for 6.10 are not to be found for 32-bit. Any idea how to proceed?
”
2
3
4
5
localhost:~ root# wget http://mirror.centos.org/centos/6/os/i386/RPM-GPG-KEY-CentOS-6
localhost:~ root# wget http://mirror.centos.org/centos/6/os/i386/Packages/centos-release-6-x.el6.centos.x.x.i686.rpm
localhost:~ root# wget http://mirror.centos.org/centos/6/os/i386/Packages/centos-indexhtml-6-x.el6.centos.noarch.rpm
localhost:~ root# wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-x.x.x-x.el6.centos.noarch.rpm
localhost:~ root# wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-plugin-fastestmirror-x.x.x-x.el6.noarch.rpm
”
They are still there. You just need to substitute the current package version numbers for the x’s in the commands. They are only examples and not meant to be directly copy/pasted.
You can find the current page names by searching here: http://mirror.centos.org/centos/6/os/i386/Packages/
Thank you very much..
I got it pretty much done, only some problem with Python.
After upgrade to Centos 6.10 from Red Hat 6.5, still has Red Hat boot up, I am guessing that the grub is still Red Hat.
Should this have changed in the above procedure?
I see that yum was stuck in the middle of labor, the complete upgrade had not completed.
Now that yum completed, all is updated, the baby is birthed, goodbye Red Hat. Thanks.
Glad it still works.
Updating some old RHEL 6.10 servers, and I get version 6.9 in the repo files and an error after running “yum update”.
As per here (http://mirror.centos.org/centos/6.9/readme) 6.9 is no longer supported, so you need to edit all the “BaseURL” entries in “/etc/yum.repo.d/” from “6.9” to just “6”.
After that, “yum update” works fine.
Reboot seems fine too…