How to convert RHEL 6.x to CentOS 6.x

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!

  1. Fully patch your system and reboot your system before starting this process
  2. Take a full backup of your system or a Snapshot if it’s a VM

Conversion

  1. Login to the server and become root
  2. Clean up yum’s cache
    localhost:~ root# yum clean all
  3. Create a temporary working area
    localhost:~ root# mkdir -p /temp/centos
    localhost:~ root# cd /temp/centos
  4. Determine your version of RHEL
    localhost:~ root# cat /etc/redhat-release
  5. Determine your architecture (32-bit = i386, 64-bit = x86_64)
    localhost:~ root# uname -i
  6. 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-bit

    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

    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
  7. Import the GPG key for the appropriate version of CentOS
    localhost:~ root# rpm --import RPM-GPG-KEY-CentOS-6
  8. 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
  9. 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
  10. Force install the CentOS RPMs we downloaded
    localhost:~ root# rpm -Uvh --force *.rpm
  11. Clean up yum one more time and then upgrade
    localhost:~ root# yum clean all
    localhost:~ root# yum upgrade
  12. Reboot your server
  13. Verify functionality
  14. Delete VM Snapshot if you took one as part of the backup

 

References

 

36 thoughts on “How to convert RHEL 6.x to CentOS 6.x”

  1. I’m encountering an error with step 8:

    yum remove rhnlib

    The message is:

    riskpp@fred$ sudo yum remove rhnlib
    Setting up Remove Process
    Resolving Dependencies
    –> Running transaction check
    —> Package rhnlib.noarch 0:2.5.22-12.el6 will be erased
    –> Processing Dependency: rhnlib >= 2.5.20 for package: rhn-client-tools-1.0.0.1-4.el6.noarch
    –> Running transaction check
    —> Package rhn-client-tools.noarch 0:1.0.0.1-4.el6 will be erased
    –> Processing Dependency: rhn-client-tools = 1.0.0.1-4.el6 for package: rhn-setup-1.0.0.1-4.el6.noarch
    –> Processing Dependency: rhn-client-tools >= 1.0.0-62 for package: yum-rhn-plugin-0.9.1-43.el6.noarch
    –> Processing Dependency: rhn-client-tools = 1.0.0.1-4.el6 for package: rhn-check-1.0.0.1-4.el6.noarch
    –> Running transaction check
    —> Package rhn-check.noarch 0:1.0.0.1-4.el6 will be erased
    –> Processing Dependency: rhn-check >= 0.0.8 for package: rhnsd-4.9.3-2.el6.x86_64
    —> Package rhn-setup.noarch 0:1.0.0.1-4.el6 will be erased
    —> Package yum-rhn-plugin.noarch 0:0.9.1-43.el6 will be erased
    –> Running transaction check
    —> Package rhnsd.x86_64 0:4.9.3-2.el6 will be erased
    –> Finished Dependency Resolution
    YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
    Eg. 6Server is not a valid and current release or hasnt been released yet/
    removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6Server.10/base/mirrorlist.txt
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

    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?

     

     

    Reply
    • 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.

      Reply
    • 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?

      Reply
  2. 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.

    Reply
    • 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*”

      Reply
  3. 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.

    Reply
    • 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.

      Reply
      • 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!

        Reply
  4. 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.

    Reply
  5. 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.

    Reply
    • 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…

      Reply
  6. 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

    Reply
  7. 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

    Reply
    • 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.

      Reply
  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)

    Reply
  9. 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.

    Reply
  10. 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?

    Reply
  11. 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?

    Reply
  12. 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.

     

    Reply
  13. Updating some old RHEL 6.10 servers, and I get version 6.9 in the repo files and an error after running “yum update”.

    http://mirror.centos.org/centos/6.9/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
    
    Trying other mirror.

    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…

    Reply

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.