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

Last modified: 2016-03-29 @ 14:20:14

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
  3. Create a temporary working area
  4. Determine your version of RHEL
  5. Determine your architecture (32-bit = i386, 64-bit = x86_64)
  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

    CentOS 6.5 / 64-bit
  7. Import the GPG key for the appropriate version of CentOS
  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.
  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.”
  10. Force install the CentOS RPMs we downloaded
  11. Clean up yum one more time and then upgrade
  12. Reboot your server
  13. Verify functionality
  14. Delete VM Snapshot if you took one as part of the backup

 

References

 

23 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?

     

     

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

  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.

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

  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.

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

  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.

  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.

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

  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

  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

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

  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)

Leave a Reply

Your email address will not be published. Required fields are marked *