RHEL

CentOS Linux 7 is reaching an important milestone in its life cycle. CentOS Linux 7 will reach end of life (EOL) on June 30, 2024. With this impending change, it is crucial for users to consider migrating from CentOS 7 to the latest version of Red Hat Enterprise Linux (RHEL). 

By migrating to the latest RHEL release, users can enjoy ongoing support, security updates, and access to the latest features and enhancements, ensuring a stable and secure operating environment. 

You can make use of the Convert2RHEL utility tool provided by Red Hat to facilitate a smooth migration from CentOS Linux 7 to the desired RHEL version. This utility simplifies the process by converting existing CentOS systems to RHEL, ensuring compatibility and a seamless transition. In this article, we will demonstrate how to convert a CentOS instance to a RHEL instance using this tool.

7 steps to migrate CentOS to RHEL using Convert2RHEL

There are a number of supported conversion paths for the Convert2RHEL utility tool. We are going to convert a machine installed with CentOS 7 into a RHEL 7 machine. Follow these steps accordingly to perform the conversion.

Step 1: Validate CentOS

To check whether you have a valid CentOS release version, enter the following:

cat  /etc/centos-release

The following output shows that this is a valid version:

CentOS Linux release 7.9.2009 (Core)

Step 2: Update your system

We want our system to be up-to-date before we start the conversion. Run all the commands as the root user (sudo).

yum  update  -y

The output:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Resolving Dependencies
--> Running transaction check
---> Package NetworkManager.x86_64 1:1.18.8-1.el7 will be updated
---> Package NetworkManager.x86_64 1:1.18.8-2.el7_9 will be an update
….

Step 3: Secure the packages

Next, we will download the signing keys to ensure that we are pulling in only Red Hat created and vetted packages by entering the following:

curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release https://www.redhat.com/security/data/fd431d51.txt

We will also copy the SSL certificates from Red Hat Subscription Management, which will allow us to pull packages over a secure channel.

curl --create-dirs -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem

Step 4: Download the repository definition

Download a repository definition from the Red Hat FTP server to our /etc/yum.repos.d/directory.

curl -o /etc/yum.repos.d/convert2rhel.repo https://ftp.redhat.com/redhat/convert2rhel/7/convert2rhel.repo

To show Convert2RHEL for CentOS 7 is configured for usage run, enter the following:

yum repoinfo convert2rhel-for-rhel-7-rpms

The output:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
convert2rhel-for-rhel-7-rpms                         	| 3.8 kB 	00:00	 
(1/3): convert2rhel-for-rhel-7-rpms/updateinfo         	| 4.3 kB   00:00	 
(2/3): convert2rhel-for-rhel-7-rpms/primary_db         	| 4.8 kB   00:00	 
(3/3): convert2rhel-for-rhel-7-rpms/group              	|  124 B   00:02	 
Repo-id  	: convert2rhel-for-rhel-7-rpms
Repo-name	: Convert2RHEL for OS 7
Repo-status  : enabled
Repo-revision: 1672752339
Repo-updated : Tue Jan  3 18:55:39 2023
Repo-pkgs	: 7
Repo-size	: 1.0 M
Repo-baseurl : https://cdn.redhat.com/content/public/convert2rhel/7/x86_64/os/
Repo-expire  : 21,600 second(s) (last: Mon Feb 13 18:06:07 2023)
  Filter 	: read-only:present
Repo-filename: /etc/yum.repos.d/convert2rhel.repo

repolist: 7

Step 5: Install convert2rhel

Install the convert2rhel utility on the machine by entering the following command:

yum install -y convert2rhel

The output:

Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : efibootmgr-17-2.el7.x86_64                               	1/3
  Installing : pexpect-2.3-11.el7.noarch                                	2/3
  Installing : convert2rhel-1.1-1.el7.noarch                            	3/3
  Verifying  : convert2rhel-1.1-1.el7.noarch                            	1/3
  Verifying  : pexpect-2.3-11.el7.noarch                                	2/3
  Verifying  : efibootmgr-17-2.el7.x86_64                               	3/3

Installed:
  convert2rhel.noarch 0:1.1-1.el7                                          	 

Dependency Installed:
  efibootmgr.x86_64 0:17-2.el7        	pexpect.noarch 0:2.3-11.el7      	 

Complete!

Step 6: Convert to RHEL

Now comes the part where we do the actual conversion. Find the organization_id by running this command:

sudo subscription-manager orgs

This will provide a name and a key as output for your registered organization. Use the name as the organization_id in the next step. Begin the conversion by running the following command:

convert2rhel --org <organization_id> --activationkey convert2rhel

If you are running a mass conversion, you can pass a -y tag to answer yes to all the questions that follow.

Continue with the system conversion? [y/n]: y


Backing up centos-indexhtml-7-9.el7.centos.noarch.
Successfully downloaded the centos-indexhtml-7-9.el7.centos.noarch package.
Backing up centos-logos-70.0.6-3.el7.centos.noarch.
Successfully downloaded the centos-logos-70.0.6-3.el7.centos.noarch package.
Backing up libreport-centos-2.1.11-53.el7.centos.x86_64.
Successfully downloaded the libreport-centos-2.1.11-53.el7.centos.x86_64 package.
Backing up libreport-plugin-mantisbt-2.1.11-53.el7.centos.x86_64.
Successfully downloaded the libreport-plugin-mantisbt-2.1.11-53.el7.centos.x86_64 package.
Removing package: centos-indexhtml-7-9.el7.centos.noarch
Removing package: centos-logos-70.0.6-3.el7.centos.noarch
Removing package: libreport-centos-2.1.11-53.el7.centos.x86_64
Removing package: libreport-plugin-mantisbt-2.1.11-53.el7.centos.x86_64
…

The conversion analyzes the system to check all the requirements are met, advises any packages that are going to be removed, and asks for confirmation from the user. Use the –debugflag for additional verbiage.

Step 7: Reboot

After the conversion is over, reboot the system as follows.

reboot

If, at any point, the conversion fails, the system will roll back to its initial state.

Take a look at /etc/redhat-release to confirm it is a RHEL 7 server.

cat /etc/redhat-release

The output:

Red Hat Enterprise Linux Server release 7.9 (Maipo)

Find more resources

If you want to have a more hands-on experience, you can follow this Red Hat curated lab. Learn more with Red Hat's hands-on labs for all skill levels. Try these labs to see your favorite products in action.

The labs include:

You can also get customized RHEL images for AWS, Google Cloud Platform, Microsoft Azure, and VMware and deploy to the platform of your choice.

Last updated: August 14, 2023