How to convert from CentOS or Oracle Linux to RHEL

Updated -

This document provides instructions on how to convert your operating system from a different Linux distribution, namely CentOS or Oracle Linux, to Red Hat Enterprise Linux (RHEL). The conversion is performed by the convert2rhel utility, which is available in the unsupported Fedora Extra Packages for Enterprise Linux (EPEL) repository.



IMPORTANT:
We recommend that you seek the support of Red Hat Consulting services to ensure that the conversion process is smooth.

The Red Hat packages installed as part of a successfully converted system are automatically eligible for Red Hat support.

Red Hat support may not be provided for the third-party packages that are left unchanged during the conversion process. See the Red Hat policy on supporting third-party software.

If you encounter any issues with the convert2rhel utility, open a Bugzilla ticket in the Fedora EPEL instance.

How OS conversion works

The automated conversion process is performed on a running system. The convert2rhel utility replaces all RPM packages from the original Linux distribution by their RHEL version. At the end of the process, it is necessary to restart the system to boot the RHEL kernel.

Available conversion paths

Currently, it is possible to convert your systems from the following Linux distributions and architectures to the corresponding major version of RHEL:

Source OS Target OS Architecture
CentOS 7 RHEL 7 64-bit Intel
CentOS 6 RHEL 6 64-bit Intel
Oracle Linux 7 RHEL 7 64-bit Intel
Oracle Linux 6 RHEL 6 64-bit Intel



RHEL 6 will exit the Maintenance Support 2 Phase of its life cycle on November 30, 2020. If you are unable to upgrade to RHEL 7 or upgrade to RHEL 8 after the conversion, and require continued maintenance for RHEL 6 after this date, we recommend that you purchase the Extended Life Cycle Support Add-on (ELS).

Prerequisites

  • Install the Fedora EPEL repository for the appropriate major version of the OS:

    # yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
    # yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
    
  • Install the convert2rhel utility:

    # yum install -y convert2rhel
    
  • Ensure that you have an access to RHEL packages through custom repositories configured in the /etc/yum.repos.d/ directory and pointing, for example, to RHEL ISO, FTP, or HTTP. Note that the OS will be converted to the version of RHEL provided by these repositories. Make sure that the RHEL minor version is the same or later than the original OS minor version to prevent downgrading and potential conversion failures. See instructions on how to configure a repository.

    Important: The convert2rhel utility currently does not import GPG keys automatically. To prevent a conversion failure, either import the RHEL GPG key (release key 2) before running convert2rhel, or ensure that yum skips the GPG key check by adding the gpgcheck=0 directive to the custom repository definitions.

  • Recommended: Update packages from the original OS to the latest version that is available in the repositories accessible from the system, and restart the system:

    # yum update -y
    # restart
    

    Without performing this step, the rollback feature will not work correctly, and exiting the conversion in any phase may result in a dysfunctional system.

IMPORTANT:
Before starting the conversion process, back up your system.

Converting the system

  1. Install convert2rhel:

    # yum install convert2rhel
    
  2. Start convert2rhel using custom repositories:

    # convert2rhel --disable-submgr --disablerepo "*" --enablerepo <RHEL_RepoID> --debug
    

    Replace RHEL_RepoID with your custom repository configured in the /etc/yum.repos.d/ directory, for example, rhel-7-server-rpms.

    To display all available options, use the -h, --help option:

    # convert2rhel -h
    

    NOTE: Packages that are available only in the original distribution and do not have corresponding counterparts in RHEL repositories, or third-party packages, which originate neither from the original Linux distribution nor from RHEL, are left unchanged.

  3. Before convert2rhel starts replacing packages from the original distribution with RHEL packages, the following warning message is displayed:

    The tool allows rollback of any action until this point. 
    By continuing all further changes on the system will need to be reverted manually by the user, if necessary.
    

    Changes made by convert2rhel up to this point can be automatically reverted. Confirm that you wish to proceed with the conversion process.

  4. Wait until convert2rhel installs the RHEL packages.

    NOTE: After a successful conversion, the utility prints out the convert2rhel command with all arguments necessary for running non-interactively. You can copy the command and use it on systems with a similar setup.

  5. At this point, the system still runs with the original distribution kernel loaded in RAM. Reboot the system to boot into the newly installed RHEL kernel.

    # reboot
    
  6. Remove third-party packages from the original OS that remained unchanged (typically packages that do not have a RHEL counterpart). To get a list of such packages, use:

    # yum list extras --disablerepo="*" --enablerepo=<RHEL_RepoID>
    
  7. If necessary, reconfigure system services after the conversion.

Troubleshooting

Logs

The convert2rhel utility stores the convert2rhel.log file in the /var/log/convert2rhel/ directory. Its content is identical to what is printed to the standard output.

The output of the rpm -Va command, which is run automatically unless the --no-rpm-va option is used, is stored in the /var/log/convert2rhel/rpm_va.log file for debugging purposes.

Rollback

The convert2rhel utility provides a limited rollback functionality. If the conversion is cancelled by the user or if it fails, the utility performs a rollback of changes made during the conversion process under the following conditions:

  • Only changes performed until convert2rhel starts replacing packages from the original distribution with RHEL packages can be reverted. This moment is indicated by the warning message:

    The tool allows rollback of any action until this point. 
    By continuing all further changes on the system will need to be reverted manually by the user, if necessary.
    

    followed by a question whether you wish to continue with the process.

  • Access to repositories providing packages from the original distribution is required, especially to the base repository, otherwise convert2rhel will be unable to restore the system to the original state even if the tool execution is stopped in the early stages of the conversion. That is because convert2rhel removes certain packages during the conversion process and needs to preemptively download them from the original repository for the case of a rollback.

  • A rollback is feasible only on a system where all packages from the original OS are updated to the latest version that is available in the repositories accessible from the system. Therefore use the yum update command before starting the conversion process.

NOTE: If the -y option is used, the question indicating the moment after which the automated rollback is no longer possible is skipped.

WARNING: If the conversion process is cancelled or fails after convert2rhel has started the package replacement phase, the system can become dysfunctional. In such a case, manual fixes are needed. Please contact Red Hat Consulting services for help.

Obtaining support

To open a support case, follow the instructions in the Knowledgebase article How do I open and manage a support case on the Customer Portal?.

To report a bug in convert2rhel, open a Bugzilla ticket in the Fedora EPEL instance.

Additional resources

Red Hat Enterprise Linux technology capabilities and limits
Red Hat Enterprise Linux documentation
Migration planning guide - migration to RHEL 6
Migration planning guide - migration to RHEL 7
How do I upgrade from Red Hat Enterprise Linux 6 to Red Hat Enterprise Linux 7?
Considerations in adopting RHEL 8
Upgrading to RHEL 8
How to create a local mirror of the latest update for Red Hat Enterprise Linux 5, 6, 7, 8 without using Satellite server?
Blog post: Converting from CentOS to RHEL with Convert2RHEL and Satellite

8 Comments

When rebooting the server may be you meet some issue with the grub. To avoid this problem please launch the following command:

grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

Hi Rim. Can you please give us more details? We haven't encountered issues with grub in our testing. What was the source system vendor and version? What was the issue you were facing about?

Hi Michel. It was a special situation, we had to install servers with centos 7.7 template provided by OVH (OVH does not provide RHEL 7.7 templates) then convert to RHEL 7.7. That's why we encountered this Grub problem.

Step 2 of Converting the system indicates "Replace RHEL_RepoID with your custom repository configured in the /etc/yum.repos.d/ directory, for example, rhel-7-server-rpms." This did not provide enough information for me to know what to update in /etc/yum.repos.d.

Hello Lucas, Thank you very much for your feedback. Please help me improve the documentation by clarifying what was insufficient.

Did you follow the instructions in prerequisites, referring to the RHEL 7 documentation about configuring repos: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sec-configuring_yum_and_yum_repositories#sec-Setting_repository_Options

Is there anything unclear or incomplete in these instructions?

Or is the placement under prerequisites rather unfortunate and can be easily missed?

Or was the problem different? Could you describe what problems you had and how you resolved them in your own words?

Thanks a lot! Lenka

The Link to "instructions on how to configure a repository." is not working (404). Also it would be great if the tool installs the repos that are needed for the conversion itself.

Thanks, Stefan, for pointing that out. Before we fix that, you can use this link: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-yum#sec-Setting_repository_Options

Regarding the second point of yours - this article explains how to use convert2rhel with custom repositories. Since Red Hat does not have the RHEL repositories public, we leave it up to the user where they obtain the RHEL repositories. For example, when they have a subscribed RHEL system in their company, they can create a mirror of the RHEL repositories available on that system by following this guide: https://access.redhat.com/solutions/23016.

However, convert2rhel is also able to connect to Red Hat Subscription Management (RHSM), and for that you need to provide the subscription-manager package and pass the subscription credentials to convert2rhel. Then the convert2rhel chooses the right repository to use for the conversion. You can find the step by step guide for that in https://www.redhat.com/en/blog/converting-centos-rhel-convert2rhel-and-satellite.

We are working on improving the user experience related to the use of RHSM.

Thanks, Stefan, for your feedback, and thanks, Michal, for the information. The link has been fixed and I added the documents Michal mentioned to Additional resources at the end of this article.