Converting from CentOS to RHEL with Convert2RHEL and Satellite

Red Hat recently released the Convert2RHEL utility, which allows CentOS, or Oracle Linux, version 6 or 7 servers on the x86_64 architecture to be converted to Red Hat Enterprise Linux (RHEL):

The conversion process works by reinstalling each of the source operating system’s packages with RHEL versions of the package. Due to this, one of the requirements of convert2rhel is that it has access to a RHEL repository for the target version of RHEL being converted to. One option for this is to create a custom repository pointed to a mounted RHEL DVD or ISO image, as covered in this article.

Another option is to utilize Red Hat Satellite to provide the RHEL repository, which is what this blog post will focus on. We will go through an example conversion of a CentOS 6 server to RHEL 6.

Some of the benefits that will be realized in the process of converting from CentOS 6 to RHEL 6 following this process include:

The converted system will be a Red Hat Enterprise Linux 6 system, eligible to receive support, including the optional Extended Life-cycle Support (ELS) which provides RHEL 6 support until June, 2024. Note that 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 for more information. If you do not wish to purchase ELS, we recommend that you first convert to RHEL 6, and then perform an upgrade to RHEL 7 or RHEL 8. For steps to upgrade to RHEL 7, please see this solution article. For steps to upgrade from RHEL 7 to RHEL 8, see this documentation.

The converted system will be registered to Satellite for future management.

When utilizing Satellite for the conversion, the packages being reinstalled will be upgraded to the version provided by Satellite (if using RHEL DVD images for the conversion, these packages will likely be out of date and require an upgrade following the conversion).

Optionally, the converted system will be configured for Red Hat Insights, which allows you to proactively identify and remediate a wide variety of potential issues.

Satellite Configuration

The first step to converting our CentOS 6 system to RHEL 6 using Satellite is to ensure the proper resources are configured in the Satellite environment. In this post we are completing a RHEL 6 conversion, however the process is similar for RHEL 7 by substituting the appropriate RHEL 7 repositories.

In many environments this Satellite configuration will already be in place, and it will simply need to be validated.

We first need to ensure that the rhel-6-server-rpms and the appropropriate Satellite Tools repository for RHEL 6 are enabled and synchronized. In this example, we are using Satellite 6.6, so the proper repository is rhel-6-server-satellite-tools-6.6-rpms. If you are using a different version of Satellite, find the corresponding Satellite Tools repository for your version of Satellite. For more information on how to complete this, see the documentation here.

Then, verify that these two repositories are part of a content view, and that the content view has been published and promoted as needed. In this example, I am using a content view with the name of RHEL6. For more information on how to complete this, see the documentation here.

Finally, ensure that an activation key has been created that is configured to use the previously covered content view. Also ensure that the Release Version is set to 6Server, and that the appropriate RHEL subscriptions have been added to the activation key, as the system being converted will require a valid subscription. In this example, the activation key is named RHEL6. For more information, see the documentation here.

Converting the System to RHEL

Now that the Satellite configuration is in place, we can jump over to the CentOS 6 system that we would like to convert. The first step is to create a full system backup of the system that is being converted in case there are unexpected issues during the conversion that require the system to be restored.

Once that has been taken care of, we will check the contents of /etc/centos-release to find the specific version of CentOS that is in use:

# cat /etc/centos-releaseCentOS release 6.10 (Final)

We will need to install the convert2rhel utility, which is available in the EPEL 6 repository. To enable the EPEL 6 repository, we’ll run the following:

We also need to make several RHEL specific packages available to convert2rhel to enable it to register the system to Satellite. There are a variety of ways that these packages could be made available to the CentOS system, including using a RHEL DVD ISO, or downloading them from the Customer Portal. In this example we will retrieve the packages off of a RHEL 6.10 base DVD ISO image. We’ll start by mounting the DVD media:

# mount /dev/sr0 /dvd

We will then import the Red Hat GPG signing key from the DVD:

# rpm --import /dvd/RPM-GPG-KEY-redhat-release

The convert2rhel utility expects that the Red Hat Subscription Management related packages are located in the /usr/share/convert2rhel/subscription-manager directory, so we’ll create this directory:

# mkdir /usr/share/convert2rhel/subscription-manager

There are three RHEL subscription-manager related RPM’s that must be placed in this directory:

There is one additional RPM we need to place in the /usr/share/convert2rhel/subscription-manager directory: the katello-ca-consumer-latest.noarch.rpm package from the Satellite server, which contains the Satellite server's certificate.

The easiest way to find the proper command to download this package is to log in to the Satellite web interface, go to the Hosts menu, and select Content Hosts. Then click the Register Content Host button in the upper right corner. You can then select the Content Source (step 1), and in step 2, the web interface will show the appropriate curl command to download the katello-ca-consumer-latest.noarch.rpm package:

We’ll cd in to the /usr/share/convert2rhel/subscription-manager directory, and then copy and paste the curl command just retrieved from the Satellite web interface:

At this point, the /usr/share/convert2rhel/subscription-manager directory should have the following four RPM packages present (your versions might vary if you downloaded later versions from the Customer Portal).

katello-ca-consumer-latest.noarch.rpm

subscription-manager-1.20.10-7.el6.x86_64.rpm

subscription-manager-rhsm-1.20.10-7.el6.x86_64.rpm

subscription-manager-rhsm-certificates-1.20.10-7.el6.x86_64.rpm

The convert2rhel utility will also need access to the redhat-release-server package in order to register the host to Satellite. This package needs to be placed in to the /usr/share/convert2rhel/redhat-release/Server/ directory. We will create this directory, and then copy the package from the mounted RHEL 6.10 base DVD (or alternatively, download it from the Customer Portal):

If the CentOS server being converted has the java-1.7.0-openjdk package installed, we might run into the issue identified in this knowledge base article. To work around this issue, we can create the directory specified in the article:

# mkdir -p /var/lib/rpm-state

In order to ensure that yum is starting from a clean state, we will run yum clean all:

At this point, everything should be ready to run the convert2rhel utility. We will use the -k flag to specify the Satellite activation key that will be used to register the system to Satellite (in this example, the RHEL6 activation key). The -o flag will specify the Satellite organization name (in this example, the example organization). In addition, we will specify the -a flag to automatically attach a compatible subscription to the system, and the --debug flag to print additional details if there is an issue with the conversion.

# convert2rhel -k RHEL6 -o example -a --debug

The convert2rhel utility will prompt you for several items, including:

Acceptance of the EULA.

Confirmation to accept the packages that will be removed. On my example conversion, these packages were centos-indexhtml-6-2.el6.centos.noarch and centos-release-6-10.el6.centos.12.3.x86_64, both of which are CentOS specific.

A list of third party packages that Red Hat won’t provide support for. On my conversion, these packages included convert2rhel-0.9-1.el6.noarch, epel-release-6-8.noarch, and pv-1.1.4-3.el6.x86_64.

A final confirmation to continue. After this point the tool will make changes that would need to be reverted manually.

The run time of the conversion will depend on a number of factors, including the number of packages that need to be reinstalled and the hardware specifications of the system being converted. In my example, the conversion took around 20 minutes to complete. During this time, several steps are completed, including the CentOS packages being reinstalled with the corresponding RHEL versions of the packages:

Once completed, convert2rhel will advise you that the system needs to be rebooted.

This can be accomplished by running the reboot command:

# reboot

If there is an issue during the conversion, refer to the log file at /var/log/convert2rhel/convert2rhel.log to help determine the cause of the issue.

Post Reboot Tasks

Following the reboot, we will login and validate the/etc/redhat-release file reflects that the system is now running Red Hat Enterprise Linux version 6.10:

Next, we’ll run a yum update on the system. Most of the packages were upgraded during the conversion, however the redhat-release-server and subscription-manager related packages from the RHEL DVD were not updated during the conversion, and might have updates available. If you had previously downloaded the current version of these packages from the Customer Portal rather than using the DVD, then the system should be up to date.

Then, we'll log in to the Satellite web interface and validate that the host is properly registered to Satellite. Once logged in, we'll go to Hosts, Content Hosts, and click on the system we’ve been working with. We will validate that the Content View and Release Version were set properly, and that the Subscription Status is Fully entitled:

The next step is to enable thesatellite-tools repository, and install the katello-host-tools and katello-agent packages on the system by running these commands: