Subscribe to our blog
Linux 

Convert2RHEL is a script that makes it easier to switch to Red Hat Enterprise Linux (RHEL). Conceptually, it's simple. The script replaces non-RHEL packages from CentOS Linux or Oracle Linux (and soon Rocky Linux and Alma Linux) with signed RHEL packages. At the time of this writing, the supported conversions are:

  • CentOS Linux 7.9 to RHEL 7.9
  • CentOS Stream 8 to RHEL 8
  • Rocky 8 to RHEL 8

Red Hat’s Convert2RHEL utility enables a guided and supported conversion in 3 basic steps:

  1. Configures access to authentic RHEL content in your instance.
  2. Performs various safety checks and reviews informational and remediation guidance on how to proceed.
  3. Performs the conversion by replacing every operating system package with its RHEL equivalent. There is no application or data to migrate. Rocky Linux and CentOS Linux components are simply replaced by the equivalent RHEL components. This is somewhat equivalent to a minor release update, in which most or all packages are updated, and it takes the same amount of time.

This article explains how the Convert2RHEL tool simplifies two common paths for converting CentOS Linux instances running on a public cloud to a fully supported RHEL, including:

  1. Convert a CentOS Linux instance in-place to RHEL with Pay As You Go (PAYG) using the Bring Your Own Subscription (BYOS) model.
  2. Convert a CentOS Linux instance in-place to RHEL using the BYOS model.

What is a supported conversion?

When a conversion is supported, it means that the tooling is not expected to produce an error, and that Red Hat is able to provide technical support to subscription owners during the conversion process.

Red Hat recently announced an extension to RHEL 7.9 ELS.  This means that if you're a CentOS Linux 7 user, you have plenty of time to get to a new release once you've converted your system to RHEL.

What is an unsupported conversion?

Convert2RHEL can replace packages on RHEL versions that are not on the list of supported options. If you choose to convert from an unsupported version, Red Hat does NOT provide support for the conversion itself, but does support the resulting RHEL installation (assuming the conversion works). Not all supported RHEL versions are targets for conversion, but you can convert up to a major release (like 8 or 9), and then follow the standard upgrade path to the latest supported minor release.

Convert2RHEL in GCP - Pay As You Go (PAYG)

Because of the way Convert2RHEL works, you can attempt to convert a virtual machine (VM) from CentOS Linux to RHEL in pretty much any location. GCP utilizes custom integrations (as do most cloud providers) with the cloud to allow for a seamless, fully managed VM environment. These integrations usually require some customization to fully convert the VM. GCP uses a Red Hat Update Infrastructure (RHUI) client to provide PAYG capabilities.

An important set of rules apply to every RHEL subscription in the cloud:

  • The customer must sign Red Hat’s terms and conditions.
  • The customer cannot enable access to Red Hat content before agreeing to terms and conditions.
  • The provider is responsible to bill the customer from the moment access to the bits is enabled.
  • The provider is responsible for requirements around dissemination of the bits.

To convert a RHEL instance with Red Hat Update Infrastructure (RHUI), first download the script that  applies to your instance:

GCP CentOS Linux 7.9

sudo bash <(curl -s \
https://raw.githubusercontent.com/MCurtisRedhat/CloudCent2RHEL/main/CentOS7toRhel7.sh)

To perform a manual conversion, you must create a global variable to prevent Convert2RHEL from looking for packages (because you will add them manually later).

export CONVERT2RHEL_OUTDATED_PACKAGE_CHECK_SKIP=1

Download the GPG key and repository configurations:

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

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

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

sudo curl -o ./gce-google-rhui-client-el7-x86_64-stable.rpm \
https://packages.cloud.google.com/yum/repos/gce-google-rhui-client-el7-x86_64-stable/Packages/819edaaa38ddbbb792684fa53b6dbbdff8a9ba22aa8e4aca96441df1130f7fb1-google-rhui-client-rhel7-8.0-1.noarch.rpm

Update the system:

sudo yum -y update

Install the Convert2RHEL package:

sudo yum -y install convert2rhel

Update your kernel, and then reboot:

sudo yum install kernel-3.10.0-1160.102.1.el7 -y && sudo reboot

Install some supporting files:

sudo yum install -y dhclient dhcp-common dhcp-libs gettext gettext-libs mokutil shim-x64

This configures access to a repository, so it might cause yum to become unusable until after a reboot:

sudo yum install gce-google-rhui-client-el7-x86_64-stable.rpm

Edit the repository to reflect the location of the files correctly:

sudo sed -i 's/$releasever/7Server/g' /etc/yum.repos.d/rh-cloud.repo

Reboot to ensure that your package manager is functional:

sudo reboot

After the reboot, install supporting packages and then run convert2rhel:

$ sudo yum install -y dhclient dhcp-common dhcp-libs \
gettext gettext-libs mokutil shim-x64
$ sudo convert2rhel --debug  --enablerepo rhui-rhel-7-server-rhui-rpms --no-rhsm -y
$ sudo restart

GCP CentOS Linux 8 Stream:

sudo bash <(curl \
-s \ https://raw.githubusercontent.com/MCurtisRedhat/CloudCent2RHEL/main/CentOS2RHEL8.sh)

To perform a manual conversion, first download the repository verification keys and configuration files:

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

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

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

sudo curl -o ./google-rhui-client-rhel8-4.0-1.noarch.rpm \
https://packages.cloud.google.com/yum/repos/gce-google-rhui-client-el8-x86_64-stable/Packages/c1afb73c8c5443c696cff1711ebc7427cdaa009df58cb87df418cc5bb1f690e5-google-rhui-client-rhel8-4.0-1.noarch.rpm

Update your system.

sudo yum update           

Install the Convert2RHEL package:

sudo yum install convert2rhel

Install some needed support services:

sudo yum install iptables iptables-ebtables iptables-libs krb5-libs \
libnghttp2 python2 python2-libs python2-pip python2-pip-wheel \
python2-setuptools python2-setuptools-wheel python36 qemu-guest-agent \
bash bind-export-libs ca-certificates device-mapper device-mapper-libs \
dmidecode gnupg2 gnupg2-smime gnutls grub2-common grub2-efi-x64 grub2-tools \
grub2-tools-efi grub2-tools-extra grub2-tools-minimal gzip iproute krb5-libs \
libcap libgcrypt libksba libnghttp2 libsemanage libssh libssh-config libtasn1 \
libxml2 nspr openssl openssl-libs pcre2 shim-x64 sqlite-libs vim-common \
vim-enhanced vim-filesystem vim-minimal xz xz-libs

Now update and reboot:

sudo yum install kernel-core-4.18.0-540.el8

You may see an alert that there is nothing to update. In this case , the "kernel update" is really just to synchronize some systems files with your boot configuration.

sudo reboot

Upon reboot, download GCP RHUI clients. Once you install this, your yum updates will fail until the update is complete, but that's expected. Install the repository for GCP RHUI:

sudo yum install google-rhui-client-rhel8-4.0-1.noarch.rpm

Make some changes to config files to help Convert2RHEL understand the system it's running on:

$ sudo sed -i 's/$releasever/8/g' /etc/yum.repos.d/rh-cloud.repo
$ sudo sed -i 's/8/8.6/g' /etc/system-release

Run convert2rhel:

sudo convert2rhel --enablerepo rhui-rhel-8-for-x86_64-appstream-rhui-rpms \
--enablerepo rhui-rhel-8-for-x86_64-baseos-rhui-rpms --no-rhsm

GCP Rocky 8

sudo bash <(curl -s \
raw.githubusercontent.com/MCurtisRedhat/CloudCent2RHEL/main/Rocky82RHEL8.sh

After performing these steps and verifying that you have a successful conversion, you must update the license. 

Update the license

Currently, there is no automated method to update the license. On a non-GCP console, you must:

  1. Install the GCP Gcloud CLI
  2. Install Gcloud components beta
  3. Initialize the GCP project containing your VM
  4. Turn down the VM with the command gcloud compute instances stop <VM_Name>
  5. Enter this in the CLI:

    For CentOS Linux 8:

    gcloud beta compute disks update <your vm bootdisk name> \
    --update-user-licenses=https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-8-server

    For CentOS Linux 7:

    gcloud beta compute disks update <your vm bootdisk name> \
    --update-user-licenses=https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-7-server

  6. Start the server with the command: gcloud compute instances start <VM_Name>

Convert2RHEL in GCP - Bring Your Own Subscription (BYOS)

The first thing to consider is how you intend to pay for your RHEL subscription. You have a few different options.

The first option is an annual subscription for RHEL, which you obtain directly from Red Hat or a reseller.

If you have RHEL subscriptions

First, log in to the Red Hat Hybrid Cloud Console and view your subscriptions.

centos-to-rhel-in-google-cloud

 

For the best experience, ensure that Simple Content Access (SCA) is enabled.  Otherwise, you must manually specify which subscription to use when you register the instance you wish to convert.

Assuming you're using SCA, navigate to All Apps & Services > Remote Host Configuration > Activation Keys. This allows you to create a named Activation Key, such as my_conversions, which you provide to the Convert2RHEL utility later. If you choose not to use SCA and activation keys, then you must follow the instructions for registering with the subscription manager tool using a username and password, and then attach a specific subscription.  SCA with an activation key is easier, and it's the recommended method.

centos-to-rhel-in-google-cloud-2

 

Start the conversion

Use the Organization ID (found on the Activation Keys page) and the activation key you created in the previous step to enable the Convert2RHEL utility so you can register the system and perform the conversion.

  1. Red Hat strongly recommends creating backups of your volume in the event of unexpected problems.  Within GCP, you can do this by taking a snapshot of the associated Elastic BlockStorage (EBS) volume.
  2. Review the documentation for Converting from an RPM-based Linux distribution to RHEL so you understand the support matrix, preparations, and other important details.
  3. Log in to your instance using SSH or the Alicloud terminal to access a shell prompt. You must have permissions to use the sudo command or to become the root super user.
  4. Update to the latest supported version of your existing OS, and install errata updates. Reboot the instance to ensure that the latest updates and kernel are applied.

    sudo yum -y update

  5. Copy the certificates to validate that the content is signed by Red Hat.

    $ sudo curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release \
    https://www.redhat.com/security/data/fd431d51.txt
    $ sudo curl --create-dirs -o /etc/rhsm/ca/redhat-uep.pem \
    https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem

    For CentOS Linux 7

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

    For CentOS Linux 8

    $ sudo curl -o /etc/yum.repos.d/convert2rhel.repo \
    https://ftp.redhat.com/redhat/convert2rhel/8/convert2rhel.repo
    $ sudo yum -y install convert2rhel

  6. Create a configuration file containing the activation key and save the file in the .ini file format.  This is the recommended method for activation keys and passwords, to ensure that sensitive information is not leaked. Delete the file when the process is complete. Place this text in the  /etc/convert2rhel.ini file:

    [subscription_manager]
    activation_key = <activation_key>

  7. Run convert2rhel:

    $ sudo convert2rhel --org <Organization_ID> --config-file <config_file_name>

  8. After conversion, it is recommended to register with the Red Hat Insights client to enable additional management capabilities at the Red Hat Hybrid Cloud Console.

    $ sudo insights-client --register

  9. After following the remaining guidance in the documentation, the system is ready to be restarted as a 100% authentic RHEL system. If you registered with Red Hat Insights,  then you now see your system in the Inventory.

Cloud-Based Auto-Registration

The other option is to use PAYG. By enabling Auto-Registration, Simple Content Access (SCA), and Subscription Watch, you enable fleet-level registration for Red Hat workloads running in selected public cloud environments. This allows you to auto-connect and gain full access to Red Hat content, analytics, and tools to manage your fleet across multiple hybrid cloud environments. In 3 steps:

  1. Follow the simple instructions to configure the mapping of Sources between your Red Hat and Cloud Partner accounts in Cloud Based Auto-Registration.
  2. Enable Subscription Watch (optional but recommended).
  3. Follow the same instructions defined in the BYOS section above to convert in-place to RHEL.

Try it yourself

Whether you use BYOS or PAYG to pay for Red Hat subscriptions, you have the best and most comprehensive experience possible with Red Hat's support.

For a demonstration of how the Convert2RHEL tool makes this an easy process, try our self-paced labs tutorial to become familiar with the process.


About the author

Browse by channel

automation icon

Automation

The latest on IT automation for tech, teams, and environments

AI icon

Artificial intelligence

Updates on the platforms that free customers to run AI workloads anywhere

open hybrid cloud icon

Open hybrid cloud

Explore how we build a more flexible future with hybrid cloud

security icon

Security

The latest on how we reduce risks across environments and technologies

edge icon

Edge computing

Updates on the platforms that simplify operations at the edge

Infrastructure icon

Infrastructure

The latest on the world’s leading enterprise Linux platform

application development icon

Applications

Inside our solutions to the toughest application challenges

Original series icon

Original shows

Entertaining stories from the makers and leaders in enterprise tech