Recently, I joined a migration task of moving several VMs of various Linux distros to RHEL7. There was the time consuming option to create new VMs and reconfigure everything from the beginning, adding each one of the custom packages, or converting to Red Hat Enterprise Linux (RHEL), using the convert2rhel utility.

The most interesting this by using this utility, is that everything happens in a powered-on VM, as the utility gradually replaces every single RPM package from Centos, by the ones from Red Hat (provided they are supported in RHEL, and not available only for the specific distribution).

Of course, you need to reboot after the process completion, in order the VM to boot under the RHEL kernel.

Step Zero:

Take a snapshot of your VM, or even a full backup. It has been a proven way to keep your butt safe during such activities.

There is also a limited convert2rhel rollback functionality which will be mentioned below.

Please note again, that packages available only in the original distro are left intact/not converted.

Starting the process, we need to add the EPEL repository, followed by the installation of the convert2rhel utility, by typing the below commands:

yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm # yum install -y

yum install -y convert2rhel

At this point, we can begin converting the system using custom repositories, using the following command. At this point, you will need to configure your custom repositories at /etc/yum.repos.d/. Be focused on this one as (in my case) typos are going to occur and things going to frustrate you (like they did to me):

First, type:

convert2rhel -h (or --help)

in order to see all available options for the convert2rhel command, in case you need to use a specific parameter to the command. Then, proceed with:

convert2rhel --disable-submgr --disablerepo "*" --enablerepo <Your custom repository mentioned few lines above> --debug

You will be presented a default system message which informs you that there is no automatic rollback after this point, where you need to confirm the conversion process in order to begin. Immediately after, the tool will start deploying the relative RHEL packages.

It will take enough time to complete, so sit back and relax. Tool will provide you a report of what has been converted at the end, including the commands required for you in case of a manual conversion.

Another way to get the report, is to browse through convert2hel’s log file, convert2rhel.log. You can find it in /var/log/convert2rhel/ directory.

There is no other thing to do at this point, but a restart, in order for the VM to boot in the RHEL kernel so type:

shutdown  -r 

Provided that everything went smoothly, you will now need to:

reconfigure system services that conversion altered

remove all 3rd party RPMs from CentOS that remained unchanged (* See step Zero about the note for the left intact packages). Use yum list extras to list all relative packages.

Last modified: October 14, 2022

Author

Comments

Write a Reply or Comment