Skip to content

Switching from CentOS 8 to Red Hat 8

We have quite a few customers still running on CentOS 8 and you probably already are aware that CentOS 8 will be end of life by the end of this year. This forces a lot of companies to either switch to an alternative or to stick with CentOS stream. For most enterprise workloads CentOS stream is not a solution as it is rolling release, and if you want to keep a Red Hat compatible enterprise distribution there are the following alternatives:

In this post we’ll look into how you can switch from CentOS 8 to Red Hat 8, as this is what we’re doing for one of our customers currently.

I did a fresh installation of CentOS 8 which brings me to this release:

[root@centos8 ~]$ cat /etc/centos-release
CentOS Linux release 8.5.2111

If you check the compatibility matrix in the official documentation you’ll find this:

Switching from CentOS 8.5 to Red Hat 8.5 seems not to be supported but as I do not want to downgrade we’ll try anyway. As Red Hat 8.5 was just released some days ago, I guess the documentation was not yet updated. For production systems, make sure that you check all prerequisites before you start.

The first step is to install the conversion tool:

[root@centos8 ~]$ curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release https://www.redhat.com/security/data/fd431d51.txt
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1855  100  1855    0     0   3644      0 --:--:-- --:--:-- --:--:--  3644
[root@centos8 ~]$ curl --create-dirs -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  7411  100  7411    0     0   4927      0  0:00:01  0:00:01 --:--:--  4924
[root@centos8 ~]$ curl -o /etc/yum.repos.d/convert2rhel.repo https://ftp.redhat.com/redhat/convert2rhel/8/convert2rhel.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   247  100   247    0     0    164      0  0:00:01  0:00:01 --:--:--   164

This creates a new yum/dnf repository definition:

[root@centos8 ~]$ cat /etc/yum.repos.d/convert2rhel.repo
[convert2rhel-for-rhel-8-rpms]
name=Convert2RHEL for OS 8
baseurl=https://cdn.redhat.com/content/public/convert2rhel/8/x86_64/os/
enabled=1
gpgcheck=1
sslcacert=/etc/rhsm/ca/redhat-uep.pem
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

… and now the conversion tool can be installed:

[root@centos8 ~]$ yum -y install convert2rhel
Convert2RHEL for OS 8                                                                                                                                                                                                                         6.5 kB/s | 3.9 kB     00:00    
Dependencies resolved.
==============================================================================================================================================================================================================================================================================
 Package                                                  Architecture                                       Version                                                                           Repository                                                                Size
==============================================================================================================================================================================================================================================================================
Installing:
 convert2rhel                                             noarch                                             0.24-2.el8                                                                        convert2rhel-for-rhel-8-rpms                                             130 k
Installing dependencies:
 python3-pip                                              noarch                                             9.0.3-20.el8                                                                      appstream                                                                 20 k
 python36                                                 x86_64                                             3.6.8-38.module_el8.5.0+895+a459eca8                                              appstream                                                                 19 k
 yum-utils                                                noarch                                             4.0.21-3.el8                                                                      baseos                                                                    73 k
Enabling module streams:
 python36                                                                                                    3.6                                                                                                                                                             

Transaction Summary
==============================================================================================================================================================================================================================================================================
Install  4 Packages

Total download size: 242 k
Installed size: 413 k
Downloading Packages:
(1/4): python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64.rpm                                                                                                                                                                               125 kB/s |  19 kB     00:00    
(2/4): yum-utils-4.0.21-3.el8.noarch.rpm                                                                                                                                                                                                      431 kB/s |  73 kB     00:00    
(3/4): python3-pip-9.0.3-20.el8.noarch.rpm                                                                                                                                                                                                    107 kB/s |  20 kB     00:00    
(4/4): convert2rhel-0.24-2.el8.noarch.rpm                                                                                                                                                                                                     440 kB/s | 130 kB     00:00    
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                         217 kB/s | 242 kB     00:01     
CentOS Linux 8 - AppStream                                                                                                                                                                                                                    1.6 MB/s | 1.6 kB     00:00    
Importing GPG key 0x8483C65D:
 Userid     : "CentOS (CentOS Official Signing Key) "
 Fingerprint: 99DB 70FA E1D7 CE22 7FB6 4882 05B5 55B3 8483 C65D
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
Key imported successfully
Convert2RHEL for OS 8                                                                                                                                                                                                                         1.8 MB/s | 1.8 kB     00:00    
Importing GPG key 0xFD431D51:
 Userid     : "Red Hat, Inc. (release key 2) "
 Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                                                      1/1 
  Installing       : python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64                                                                                                                                                                                                 1/4 
  Running scriptlet: python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64                                                                                                                                                                                                 1/4 
  Installing       : python3-pip-9.0.3-20.el8.noarch                                                                                                                                                                                                                      2/4 
  Installing       : yum-utils-4.0.21-3.el8.noarch                                                                                                                                                                                                                        3/4 
  Installing       : convert2rhel-0.24-2.el8.noarch                                                                                                                                                                                                                       4/4 
  Running scriptlet: convert2rhel-0.24-2.el8.noarch                                                                                                                                                                                                                       4/4 
  Verifying        : python3-pip-9.0.3-20.el8.noarch                                                                                                                                                                                                                      1/4 
  Verifying        : python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64                                                                                                                                                                                                 2/4 
  Verifying        : yum-utils-4.0.21-3.el8.noarch                                                                                                                                                                                                                        3/4 
  Verifying        : convert2rhel-0.24-2.el8.noarch                                                                                                                                                                                                                       4/4 

Installed:
  convert2rhel-0.24-2.el8.noarch                               python3-pip-9.0.3-20.el8.noarch                               python36-3.6.8-38.module_el8.5.0+895+a459eca8.x86_64                               yum-utils-4.0.21-3.el8.noarch                              

Complete!

For actually converting the system to Red Hat Enterprise Linux you need access to the Red Hat portal and an active subscription you can attach to the system:

[root@centos8 ~]$ convert2rhel --username [username] --password [password]

The first output you’ll see is the license agreement:

[11/18/2021 03:22:53] TASK - [Prepare: Show Red Hat software EULA] ******************************
The following text is a copy of the November 18, 2019 version of Red Hat GPLv2-Based End User License Agreement (EULA) [1].
For up-to-date version of the EULA, visit [2].
[1] https://www.redhat.com/licenses/Red_Hat_GPLv2-Based_EULA_20191118.pdf
[2] https://www.redhat.com/en/about/agreements

END USER LICENSE AGREEMENT
RED HAT GPLv2-BASED
...

Before you proceed, make sure that all the checks/tasks are successful, e.g.:

[11/18/2021 03:23:16] TASK - [Prepare: Checking the firmware interface type (BIOS/UEFI)] ********
BIOS detected.

[11/18/2021 03:23:16] TASK - [Prepare: Checking /mnt and /sys are read-write] *******************
Read-only /mnt or /sys mount points not detected.

[11/18/2021 03:23:16] TASK - [Prepare: Check kernel compatibility with RHEL] ********************
Kernel is compatible with RHEL

[11/18/2021 03:23:16] TASK - [Prepare: Checking if --enablerepo repositories are accessible] ****
Skipping the check of repositories due to the use of RHSM for the conversion.

Also note the packages that will be removed, maybe you need to re-install them after the conversion:

WARNING - The following packages will be removed...
Package                               Vendor/Packager  Repository
-------                               ---------------  ----------
centos-logos-85.8-2.el8.x86_64        CentOS           @baseos
centos-logos-httpd-85.8-2.el8.noarch  CentOS           @baseos
centos-gpg-keys-8-3.el8.noarch        CentOS           @baseos

Once you are sure to proceed:

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

Backing up centos-logos-85.8-2.el8.x86_64
Successfully downloaded the centos-logos-85.8-2.el8.x86_64 package.
Backing up centos-logos-httpd-85.8-2.el8.noarch
Successfully downloaded the centos-logos-httpd-85.8-2.el8.noarch package.
Backing up centos-gpg-keys-8-3.el8.noarch
Successfully downloaded the centos-gpg-keys-8-3.el8.noarch package.
Removing package: centos-logos-85.8-2.el8.x86_64
Removing package: centos-logos-httpd-85.8-2.el8.noarch
Removing package: centos-gpg-keys-8-3.el8.noarch
...

Again, double check that all the tasks/checks are fine, e.g.:

[11/18/2021 03:26:15] TASK - [Convert: Resolve possible edge cases] *****************************
Checking if java-1.7.0-openjdk is installed.
java-1.7.0-openjdk not installed.
Removing shim-x64 package yum protection.
Relevant to Oracle Linux 7 only. Skipping.

[11/18/2021 03:26:15] TASK - [Convert: Subscription Manager - Download packages] ****************
Successfully downloaded the subscription-manager package.
Successfully downloaded the subscription-manager-rhsm-certificates package.
Successfully downloaded the python3-subscription-manager-rhsm package.
Successfully downloaded the dnf-plugin-subscription-manager package.
Successfully downloaded the python3-syspurpose package.
...

Finally select the subscription you want to attach to the system:

Enter number of the chosen subscription: 11

Attaching subscription with pool ID xxxx to the system ...
Successfully attached a subscription for: Red Hat Enterprise Linux, Standard Support (128 Sockets, NFR, Partner Only)

[11/18/2021 03:30:42] TASK - [Convert: Get RHEL repository IDs] *********************************
RHEL repository IDs to enable: rhel-8-for-x86_64-baseos-rpms, rhel-8-for-x86_64-appstream-rpms

[11/18/2021 03:30:42] TASK - [Convert: Subscription Manager - Check required repositories] ******
Verifying needed RHEL repositories are available ... 
Repositories available through RHSM:
...
Needed RHEL repos are available.

[11/18/2021 03:31:13] TASK - [Convert: Subscription Manager - Disable all repositories] *********
Repositories disabled.

[11/18/2021 03:31:58] TASK - [Convert: Remove packages containing repofiles] ********************
Searching for packages containing repofiles or affecting variables in the repofiles:

centos-release* ................................. 0
centos-repos .................................... 0
centos-linux-repos .............................. 1
centos-stream-repos ............................. 0
centos-linux-release ............................ 1
centos-stream-release ........................... 0


WARNING - The following packages will be removed...
Package                                     Vendor/Packager  Repository
-------                                     ---------------  ----------
centos-linux-repos-8-3.el8.noarch           CentOS           @baseos
centos-linux-release-8.5-1.2111.el8.noarch  CentOS           @baseos


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


Backing up centos-linux-repos-8-3.el8.noarch
Successfully downloaded the centos-linux-repos-8-3.el8.noarch package.
Backing up centos-linux-release-8.5-1.2111.el8.noarch
Successfully downloaded the centos-linux-release-8.5-1.2111.el8.noarch package.
Removing package: centos-linux-repos-8-3.el8.noarch
Removing package: centos-linux-release-8.5-1.2111.el8.noarch

[11/18/2021 03:33:20] TASK - [Convert: Subscription Manager - Enable RHEL repositories] *********
Repositories enabled through subscription-manager

[11/18/2021 03:33:58] TASK - [Convert: Final system checks before main conversion] **************
Comparing the loaded kernel modules with the modules available in the following RHEL kernel packages available in the enabled repositories:
 kernel-core-0:4.18.0-348.2.1.el8_5.x86_64
 kernel-debug-core-0:4.18.0-348.2.1.el8_5.x86_64
 kernel-debug-modules-0:4.18.0-348.2.1.el8_5.x86_64
 kernel-debug-modules-extra-0:4.18.0-348.2.1.el8_5.x86_64
 kernel-modules-0:4.18.0-348.2.1.el8_5.x86_64
 kernel-modules-extra-0:4.18.0-348.2.1.el8_5.x86_64
 kmod-kvdo-0:6.2.5.72-81.el8.x86_64
 kmod-redhat-atlantic-0:4.18.0_255.el8_dup8.3-1.el8_3.x86_64
 kmod-redhat-bnxt_en-0:1.10.0_dup8.1-2.el8_1.x86_64
 kmod-redhat-btusb-0:0.8_4.18.0_80.23_dup8.0-4.el8_0.x86_64
 kmod-redhat-ice-0:0.8.2_k_dup8.2-1.el8_2.x86_64
 kmod-redhat-ionic-0:4.18.0.210_dup8.2-2.el8_2.x86_64
 kmod-redhat-iwlwifi-0:4.18.0_107_dup8.0-5.el8_0.x86_64
 kmod-redhat-mlx5_core-0:5.0_0_dup8.2-2.el8_2.x86_64
 kmod-redhat-mpt3sas-0:35.101.00.00_dup8.3-1.el8_3.x86_64
 kmod-redhat-oracleasm-8:2.0.8-12.el8.x86_64
 kmod-redhat-oracleasm-kernel_4_18_0_240-8:2.0.8-1.3.el8_3.x86_64
 kmod-redhat-oracleasm-kernel_4_18_0_240_14_1-8:2.0.8-1.3.el8_3.x86_64
WARNING - ********************************************************
WARNING - The tool allows rollback of any action until this point.
WARNING - By continuing all further changes on the system will need to be reverted manually by the user, if necessary.
WARNING - ********************************************************

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

Up until now you can rollback any changes, so please check all the output carefully before you continue from here. The following step will take some time as a lot of packages will be updated/replaced:

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



[11/18/2021 03:36:16] TASK - [Convert: Import Red Hat GPG keys] *********************************
GPG keys imported.
GPG keys imported.

[11/18/2021 03:36:16] TASK - [Convert: Prepare kernel] ******************************************
Installing RHEL kernel ...
Updating Subscription Management repositories.
Last metadata expiration check: 0:02:03 ago on Thu Nov 18 03:34:16 2021.
Package kernel-4.18.0-348.2.1.el8_5.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

Conflict of kernels: One of the installed kernels has the same version as the latest RHEL kernel.
Updating Subscription Management repositories.
Last metadata expiration check: 0:02:12 ago on Thu Nov 18 03:34:16 2021.
Dependencies resolved.
================================================================================
 Package         Arch    Version           Repository                      Size
================================================================================
Installing:
 kernel          x86_64  4.18.0-348.el8    rhel-8-for-x86_64-baseos-rpms  7.0 M
Installing dependencies:
 kernel-core     x86_64  4.18.0-348.el8    rhel-8-for-x86_64-baseos-rpms   38 M
 kernel-modules  x86_64  4.18.0-348.el8    rhel-8-for-x86_64-baseos-rpms   30 M
...
[11/18/2021 03:39:56] TASK - [Convert: Replace packages] ****************************************
Performing update of the CentOS Linux packages ...
Updating Subscription Management repositories.
Last metadata expiration check: 0:05:46 ago on Thu Nov 18 03:34:16 2021.
Dependencies resolved.
========================================================================================================================
 Package                       Arch    Version                                   Repository                         Size
========================================================================================================================
Upgrading:
 buildah                       x86_64  1.22.3-2.module+el8.5.0+12582+56d94c81    rhel-8-for-x86_64-appstream-rpms  7.7 M
 cockpit-podman                noarch  33-1.module+el8.5.0+12582+56d94c81        rhel-8-for-x86_64-appstream-rpms  437 k
 conmon                        x86_64  2:2.0.29-1.module+el8.5.0+12582+56d94c81  rhel-8-for-x86_64-appstream-rpms   52 k
 container-selinux             noarch  2:2.167.0-1.module+el8.5.0+12582+56d94c81 rhel-8-for-x86_64-appstream-rpms   54 k
 containernetworking-plugins   x86_64  1.0.0-1.module+el8.5.0+12582+56d94c81     rhel-8-for-x86_64-appstream-rpms   19 M
 containers-common             noarch  2:1-2.module+el8.5.0+12582+56d94c81       rhel-8-for-x86_64-appstream-rpms   77 k
 criu                          x86_64  3.15-3.module+el8.5.0+12582+56d94c81      rhel-8-for-x86_64-appstream-rpms  518 k
...
Performing reinstallation of the CentOS Linux packages ...
Updating Subscription Management repositories.
Last metadata expiration check: 0:06:46 ago on Thu Nov 18 03:34:16 2021.
Dependencies resolved.
=========================================================================================================================
 Package                                Arch    Version                           Repository                         Size
=========================================================================================================================
Reinstalling:
 NetworkManager                         x86_64  1:1.32.10-4.el8                   rhel-8-for-x86_64-baseos-rpms     2.6 M
 NetworkManager-config-server           noarch  1:1.32.10-4.el8                   rhel-8-for-x86_64-baseos-rpms     131 k
 NetworkManager-libnm                   x86_64  1:1.32.10-4.el8                   rhel-8-for-x86_64-baseos-rpms     1.8 M
 NetworkManager-libreswan               x86_64  1.2.10-4.el8                      rhel-8-for-x86_64-appstream-rpms  120 k
 NetworkManager-team                    x86_64  1:1.32.10-4.el8                   rhel-8-for-x86_64-baseos-rpms     149 k
 NetworkManager-tui                     x86_64  1:1.32.10-4.el8                   rhel-8-for-x86_64-baseos-rpms     336 k
 PackageKit                             x86_64  1.1.12-6.el8                      rhel-8-for-x86_64-appstream-rpms  599 k
 PackageKit-glib                        x86_64  1.1.12-6.el8                      rhel-8-for-x86_64-appstream-rpms  140 k
 abattis-cantarell-fonts                noarch  0.0.25-6.el8                      rhel-8-for-x86_64-appstream-rpms  156 k
...
Dependencies resolved.
Nothing to do.
Complete!
Received return code: 0


[11/18/2021 03:52:35] TASK - [Convert: List remaining non-Red Hat packages] *********************
Listing packages not signed by Red Hat
All packages are now signed by Red Hat.

[11/18/2021 03:52:37] TASK - [Convert: Configure the bootloader] ********************************
BIOS detected. Nothing to do.

[11/18/2021 03:52:37] TASK - [Convert: Patch yum configuration file] ****************************
Skipping patching, yum configuration file not modified

[11/18/2021 03:52:37] TASK - [Final: rpm files modified by the conversion] **********************
Running the 'rpm -Va' command which can take several minutes. It can be disabled by using the --no-rpm-va option.

Running the 'rpm -Va' command which can take several minutes. It can be disabled by using the --no-rpm-va option.
The 'rpm -Va' output has been stored in the /var/log/convert2rhel/rpm_va_after_conversion.log file
Comparison of modified rpm files from before and after the conversion:
--- /var/log/convert2rhel/rpm_va.log
+++ /var/log/convert2rhel/rpm_va_after_conversion.log
@@ -0,0 +1,2 @@
+....L....  c /etc/nsswitch.conf
+.M.......  g /var/lib/plymouth/boot-duration
@@ -2,2 +3,0 @@
-.M.......  g /var/lib/plymouth/boot-duration
-....L....  c /etc/nsswitch.conf
@@ -9,2 +8,0 @@
-.......T.  c /etc/selinux/targeted/contexts/customizable_types
-.......T.    /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[11/18/2021 03:53:03] TASK - [Final: Remove temporary folder /var/lib/convert2rhel/] ************
Temporary folder /var/lib/convert2rhel/ removed

Conversion successful!

WARNING - In order to boot the RHEL kernel, restart of the system is needed.

Time to reboot and check if all is fine:

[root@centos8 ~]$ systemctl reboot
[root@centos8 ~]$ Connection to 192.168.100.243 closed by remote host.
Connection to 192.168.100.243 closed.
dwe@ltdwe:~$ ssh [email protected]
[email protected]'s password: 
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Thu Nov 18 02:38:37 2021 from 192.168.100.1
[root@centos8 ~]$ cat /etc/os-release 
NAME="Red Hat Enterprise Linux"
VERSION="8.5 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.5"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.5 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.5
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.5"

[root@centos8 ~]$ dnf repolist
Updating Subscription Management repositories.
repo id                                                                                                                    repo name
convert2rhel-for-rhel-8-rpms                                                                                               Convert2RHEL for OS 8
rhel-8-for-x86_64-appstream-rpms                                                                                           Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
rhel-8-for-x86_64-baseos-rpms                                                                                              Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)

[root@centos8 ~]$ dnf update -y
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)                                                                                                                                                                                         3.9 MB/s |  41 MB     00:10    
Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)                                                                                                                                                                                      4.1 MB/s |  37 MB     00:09    
Last metadata expiration check: 0:00:03 ago on Thu 18 Nov 2021 03:55:39 AM EST.
Dependencies resolved.
Nothing to do.
Complete!

Looks good. In real live it might be more complicated, depending on what is installed on the original system.

Let’s work together

Ready to operate at
the next level?

Tell us about your challenge. We’ll bring the depth, the expertise, and the Swiss precision.

Open source Team

Open source Team

Posts published under the Open source Team account are collective contributions by the dbi services open infrastructure consultants. The practice covers open-source databases and platforms, PostgreSQL first of all, along with MySQL, MariaDB, and Linux, from architecture, replication, and high availability to performance tuning and operations under service level agreements, and contributes actively to the PostgreSQL community.View Author posts

721 posts since September 2011

Most read in Database

The Database posts our readers open most: the all-time favourites, and what is trending right now.

Leave a Comment

Your email address will not be published. Required fields are marked *