Red Hat 블로그
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.
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.
Do you know about Red Hat Enterprise Linux's latest features and updates?
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-release CentOS 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:
# yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
Then, we can install
convert2rhel with the following command:
# yum install convert2rhel
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
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:
We will copy over these RPM’s from the mounted RHEL 6.10 base DVD:
# cd /dvd/Packages # cp subscription-manager-1.20.10-7.el6.x86_64.rpm /usr/share/convert2rhel/subscription-manager # cp subscription-manager-rhsm-1.20.10-7.el6.x86_64.rpm /usr/share/convert2rhel/subscription-manager # cp subscription-manager-rhsm-certificates-1.20.10-7.el6.x86_64.rpm /usr/share/convert2rhel/subscription-manager
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
cdin to the
/usr/share/convert2rhel/subscription-managerdirectory, and then copy and paste the
curlcommand just retrieved from the Satellite web interface:
# cd /usr/share/convert2rhel/subscription-manager # curl --insecure --output katello-ca-consumer-latest.noarch.rpm https://sat66.example.com/pub/katello-ca-consumer-latest.noarch.rpm
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).
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):
# mkdir -p /usr/share/convert2rhel/redhat-release/Server/ # cd /usr/share/convert2rhel/redhat-release/Server/ # cp /dvd/Packages/redhat-release-server-6Server-18.104.22.168.el6.x86_64.rpm .
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:
# yum clean all Loaded plugins: fastestmirror, refresh-packagekit, security Cleaning repos: base epel extras updates Cleaning up Everything Cleaning up list of fastest mirrors
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
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
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:
convert2rhel will advise you that the system needs to be rebooted.
This can be accomplished by running the reboot command:
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:
# cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.10 (Santiago)
Then we will validate that the CentOS repositories were removed, and the
rhel-6-server-rpms repository, provided by Satellite server, is available by running
# yum repolist Loaded plugins: fastestmirror, product-id, refresh-packagekit, search-disabled- : repos, security, subscription-manager Loading mirror speeds from cached hostfile rhel-6-server-rpms | 2.0 kB 00:00 repo id repo name status rhel-6-server-rpms Red Hat Enterprise Linux 6 Server (RPMs) 20,999 repolist: 20,999
We will also run
subscription-manager list and validate that the system is subscribed:
# subscription-manager list +-------------------------------------------+ Installed Product Status +-------------------------------------------+ Product Name: Red Hat Enterprise Linux Server Product ID: 69 Version: 6.10 Arch: x86_64 Status: Subscribed Status Details: Starts: 08/12/2019 Ends: 12/31/2021
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 the
satellite-tools repository, and install the
katello-agent packages on the system by running these commands:
# subscription-manager repos --enable=rhel-\*-satellite-tools-\*-rpms # yum -y install katello-host-tools # yum -y install katello-agent
Finally, one last optional step. If desired you can install the Insights agent and register the system with Insights, by running the following commands:
# yum install insights-client # insights-client --register
We can then view the Insights findings from the Insights Overview page (must be logged in), or from within the Satellite web interface by going to the Insights menu, and selecting Inventory.
Summary and Closing
In this example, we started with a CentOS 6 server and converted it to a supported RHEL 6 system, managed by Satellite and Insights. Converting a system to RHEL using this method has many advantages:
Running a supported operating system that is eligible for Red Hat Support.
Optional Extended Lifecycle Support, which provides RHEL 6 support until June, 2024, in contrast to CentOS 6 which will be at the end of maintenance updates on November 30, 2020.
System management with Red Hat Satellite.
Red Hat Insights, which is included in RHEL subscriptions at no additional cost, and which allows you to proactively identify and remediate a wide variety of potential issues.
Increasing standardization in your environment by reducing the number of operating systems present in the environment.
Convert2RHEL is not an officially supported tool at this time and is self-service only. We recommend that customers who want to convert non-RHEL systems to RHEL set up a consulting engagement with Red Hat's Consulting Services.
About the author
Brian Smith is a Product Manager at Red Hat focused on RHEL automation and management. He has been at Red Hat since 2018, previously working with Public Sector customers as a Technical Account Manager (TAM).