This guide provides step-by-step instructions for performing a smooth CentOS to RHEL Migration with the Convert2RHEL tool. CentOS (Community ENTerprise Operating System) was one of the most preferred and widely used Linux distributions, particularly in the enterprise world. It was popular due to its stability, community support, and binary compatibility with Red Hat Enterprise Linux (RHEL). However, in light of IBM’s RedHat acquisition in 2020, the company decided to end support for CentOS and converted it into CentOS stream, a rolling-release distribution for development and testing.
Essentially, CentOS 7 support ended on June 30, 2024, and CentOS 8 support ended on December 31, 2021. As such, if you are still running workloads on CentOS 7/8, it is crucial to consider migrating to RHEL. Continuing to operate on unsupported systems exposes you to significant security risks and leaves you without access to critical updates and patches.
Table of Contents
Effortless CentOS to RHEL Migration with the Convert2RHEL Tool
Why Migrating to RHEL is Paramount
While you can still switch to AlmaLinux/Rocky Linux, the most common forks of CentOS Linux, migrating entirely to RHEL comes with some benefits outlined below:
- Enhanced Security: RHEL boasts a robust security framework with regular security updates and patches, minimizing vulnerabilities and protecting your systems from threats.
- Stronger Support: With RHEL, you gain access to comprehensive support from RedHat, including expert assistance, troubleshooting, and proactive maintenance.
- Improved Stability and Reliability: RHEL is known for its stability and reliability, ensuring smooth operation and minimizing downtime.
- Enhanced Performance: RHEL is optimized for performance, delivering faster application execution and improved resource utilization.
What other Linux OS are Eligible for Conversion to RHEL?
Apart from CentOS Linux, other OSes that can be migrated or converted into RHEL include:
- Alma Linux
- Oracle Linux
- Rocky Linux
Supported Conversion Paths
As of this writing, this is the current supported conversion path:
Source OS | Target OS | Architecture |
AlmaLinux 9.5 | RHEL 9.5 | 64-bit Intel |
AlmaLinux 8.10 | RHEL 8.10 | 64-bit Intel |
AlmaLinux 8.8 | RHEL 8.8 EUS | 64-bit Intel |
CentOS Linux 8.5 | RHEL 8.5 | 64-bit Intel |
CentOS Linux 7.9 | RHEL 7.9 | 64-bit Intel |
Oracle Linux 9.5 | RHEL 9.5 | 64-bit Intel |
Oracle Linux 8.10 | RHEL 8.10 | 64-bit Intel |
Oracle Linux 7.9 | RHEL 7.9 | 64-bit Intel |
Rocky Linux 9.5 | RHEL 9.5 | 64-bit Intel |
Rocky Linux 8.10 | RHEL 8.10 | 64-bit Intel |
Rocky Linux 8.8 | RHEL 8.8 EUS | 64-bit Intel |
Kindly note that it is not possible to directly convert from current source OS version e.g from CentOS 8.5 to the latest available minor version of RHEL 8 e.g RHEL 8.10. It is therefore recommended to update your system to the latest version of RHEL after the conversion.
Prerequisites for Conversion to RHEL
A summary of the prerequisites for converting to RHEL:
- Backup & Restore: Create a full system backup and ensure its restorability.
- Compatibility Check: Verify system eligibility for RHEL conversion.
- Update the original OS to the minor version supported for conversion as specified in table above. For example, if on CentOS 7.5, update to CentOS 7.9 and then reboot the system.
- Stop Critical Services: Pause essential services to prevent data loss or corruption.
- Disable Antivirus: Temporarily disable antivirus softwareif you are running any.
- Reconfigure Configuration Management: Adjust or disable tools like Salt, Chef, Puppet, and Ansible.
- Install sos Package: Install the sos package for support case generation.
- Activate Key: Obtain an activation key from Satellite or RHSM.
- Disable Secure Boot: UEFI systems with Secure Boot enabled are not supported for conversion. Disable the same before the conversion.
- Enable Simple Content Access: Ensure SCA is enabled for accounts created after July 15, 2022.
- Access to RHEL Packages: Ensure you have access to RHEL packages either via:
- RedHat CDN via RHSM with a valid Red Hat account and subscription.
- Red Hat Satellite with RHEL 7, RHEL 8.x (AppStream and BaseOS), RHEL 9 (AppStream and BaseOS) repositories imported and synchronized.
- Custom repositories pointing to RHEL mirrors for disconnected systems. For example, if upgrading from CentOS 7.9 to RHEL 7.9, you can get RHEL 7.9 DVD iso and mount locally on the host and configure custom repo on /etc/yum.repo.d/ to point to ISO mount point (AppStream/BaseOS).
- Register your System: If using Red Hat Satellite server for conversion, register your system with Red Hat Satellite. Similarly, if using RHSM, ensure you have registered your system or update your organization ID and activation key in the
/etc/convert2rhel.ini
file. - Update HTTP Proxy configuration: If you are connecting to Internet via HTTP proxy, ensure YUM/or RHSM is configured to use HTTP proxy.
- Remove CentOS Stream packages: If you have any CentOS Stream packages in place, remove them before conversion as they may hinder the conversion process.
What Happens During Conversion?
The Convert2RHEL
utility facilitates an in-place conversion of supported Linux distributions (like CentOS, AlmaLinux, Oracle Linux) to Red Hat Enterprise Linux (RHEL). In essence;
- The tool replaces the original distribution’s packages with their RHEL equivalents.
- Packages build from source or installed from third-party sources remain unaffected.
- Generally, user data in
/home
and/srv
directories is not directly affected. However, package scriptlets executed during the conversion process might have unintended consequences
Update CentOS Repository URLs
CentOS has reached EOL and hence, no longer receiving updates from the official CentOS repositories.
Sample error you may get while using default repos on CentOS 7.
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
One of the configured repositories failed (Unknown),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail.
To fix this, run the commands below to update the repo URLS.
sudo sed -i 's/^mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=https://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
Upgrade OS to the Latest Minor Release Version
You need to ensure that you are on the latest minor release version.
For example, we are currently running CentOS 7.5;
cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
Since we are intending to migrate to RHEL 7.9, then we need to ensure that we are on CentOS 7.9.
Therefore, run system update.
yum update
Once the update is done, reboot the system and confirm that it is indeed updated to the latest OS minor release version.
systemctl reboot
The reconfirm OS version;
cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
And we are now good to proceed.
And for informational sake, I am running a web application and here are versions of major components.
mysql -V
mysql Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1
php -v
PHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: May 30 2023 14:01:11
Install Convert2RHEL Tool on CentOS
To install the conversion tool, you need to install the RedHat repository providing the package.
Thus, begin by installing the repository signing key;
curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release https://security.access.redhat.com/data/fd431d51.txt
Install the repository for the respective OS to upgrade to;
RHEL 7;
curl -o /etc/yum.repos.d/convert2rhel.repo https://cdn-public.redhat.com/content/public/repofiles/convert2rhel-for-rhel-7-x86_64.repo
RHEL 8;
curl -o /etc/yum.repos.d/convert2rhel.repo https://cdn-public.redhat.com/content/public/repofiles/convert2rhel-for-rhel-8-x86_64.repo
RHEL 9;
curl -o /etc/yum.repos.d/convert2rhel.repo https://cdn-public.redhat.com/content/public/repofiles/convert2rhel-for-rhel-9-x86_64.repo
Once the repos are in place, install the Convert2RHEL
utility:
yum -y install convert2rhel
Ensure Access to RHEL Packages
As already mentioned before, you need to ensure that you have access to RHEL packages.
In our setup, we have RHEL 7.9 repos locally available on the CentOS 7.9 system as follows;
cat /etc/yum.repos.d/rhel.repo
[rhel7.9]
name = RHEL 7.9 Repos
baseurl = file:///media/
gpgcheck = 1
gpgkey = file:///media/RPM-GPG-KEY-redhat-release
enabled = 1
Generate RHEL Pre-conversion Analysis Report
convert2rhel analyze
is a command that can be used to check the eligibility of a system for conversion to Red Hat Enterprise Linux (RHEL). It performs a pre-conversion analysis to ensure that the system is compatible with RHEL and highlights any issues that may prevent a successful conversion.
convert2rhel analyze
When you run the command, the possible output is:
- Info: No impact, just informational.
- Success: No issues found, ready for conversion.
- Error: Critical issue that must be fixed before conversion.
- Overridable: Issue that can be overridden but should be fixed to avoid problems.
- Warning: Non-critical issue that may cause issues post-conversion.
- Skip: Test skipped due to a prerequisite failure, may affect conversion.
Well, in my setup environment, I couldnt access credentials for the subscription. As such, we specify the RHEL repo ID (you can use wildcards) as well as no RHSM;
convert2rhel analyze --enablerepo rhel7.9 --no-rhsm --els
Sample output;
...
========== Success (No changes needed) ==========
(SUCCESS) CHECK_FIREWALLD_AVAILABILITY::SUCCESS - N/A
(SUCCESS) IS_LOADED_KERNEL_LATEST::SUCCESS - N/A
(SUCCESS) CUSTOM_REPOSITORIES_ARE_VALID::SUCCESS - N/A
(SUCCESS) DBUS_IS_RUNNING::SUCCESS - N/A
(SUCCESS) BACKUP_REPOSITORY::SUCCESS - N/A
(SUCCESS) SUBSCRIBE_SYSTEM::SUCCESS - N/A
(SUCCESS) PRE_SUBSCRIPTION::SUCCESS - N/A
(SUCCESS) EFI::SUCCESS - N/A
(SUCCESS) DUPLICATE_PACKAGES::SUCCESS - N/A
(SUCCESS) READ_ONLY_MOUNTS_SYS::SUCCESS - N/A
(SUCCESS) READ_ONLY_MOUNTS_MNT::SUCCESS - N/A
(SUCCESS) REMOVE_SPECIAL_PACKAGES::SUCCESS - N/A
(SUCCESS) BACKUP_REDHAT_RELEASE::SUCCESS - N/A
(SUCCESS) PACKAGE_UPDATES::SUCCESS - N/A
(SUCCESS) LIST_THIRD_PARTY_PACKAGES::SUCCESS - N/A
(SUCCESS) EUS_SYSTEM_CHECK::SUCCESS - N/A
(SUCCESS) ELS_SYSTEM_CHECK::SUCCESS - N/A
(SUCCESS) BACKUP_YUM_VARIABLES::SUCCESS - N/A
(SUCCESS) REMOVE_IWLAX2XX_FIRMWARE::SUCCESS - N/A
(SUCCESS) VALIDATE_PACKAGE_MANAGER_TRANSACTION::SUCCESS - N/A
(SUCCESS) BACKUP_PACKAGE_FILES::SUCCESS - N/A
(SUCCESS) RHEL_COMPATIBLE_KERNEL::SUCCESS - N/A
(SUCCESS) TAINTED_KMODS::SUCCESS - N/A
(SUCCESS) GRUB_VALIDITY::SUCCESS - N/A
(SUCCESS) ENSURE_KERNEL_MODULES_COMPATIBILITY::SUCCESS - N/A
(SUCCESS) INSTALL_RED_HAT_GPG_KEY::SUCCESS - N/A
(SUCCESS) INSTALL_RED_HAT_CERT_FOR_YUM::SUCCESS - N/A
(SUCCESS) CONVERT2RHEL_LATEST_VERSION::SUCCESS - N/A
========== Info (No changes needed) ==========
(INFO) REMOVE_SPECIAL_PACKAGES::SPECIAL_PACKAGES_REMOVED - Special packages to be removed
Description: We have identified installed packages that match a pre-defined list of packages that are to be removed during the conversion
Diagnosis: The following packages will be removed during the conversion: geoipupdate-2.5.0-2.el7.x86_64, centos-release-7-9.2009.2.el7.centos.x86_64
Remediations: N/A
========== Warning (Review and fix if needed) ==========
(WARNING) PRE_SUBSCRIPTION::PRE_SUBSCRIPTION_CHECK_SKIP - Pre-subscription check skip
Description: Detected --no-rhsm option. Did not perform the check.
Diagnosis: N/A
Remediations: N/A
(WARNING) SUBSCRIBE_SYSTEM::SUBSCRIPTION_CHECK_SKIP - Subscription check skip
Description: Detected --no-rhsm option. Did not perform the check.
Diagnosis: N/A
Remediations: N/A
As you can see, ========== Success (No changes needed) ==========.
Review the report and resolve any issue. Rerun the analyzer again and until you confirm you are ready to go.
CentOS to RHEL Migration with the Convert2RHEL Tool
If there is no inhibitor, proceed with migration.
You would run this command if you had RHSM;
convert2rhel
Otherwise, if using custom repos to upgrade, then you need to specify –no-rhsm and the --enablerepo <RHEL_RepoID1> --enablerepo <RHEL_RepoID2>
options.
convert2rhel --enablerepo rhel7.9 --no-rhsm --els
Here is a snippet of the my CentOS 7.9 to RHEL 7.9 conversion output;
Installing for i386-pc platform.
Installation finished. No error reported.
Successfully updated GRUB2 on the system.
UPDATE_GRUB has succeeded
[2025-01-24T15:57:52+0000] TASK - [Convert: Update breadcrumbs] **************************************
Writing breadcrumbs to '/etc/migration-results'.
Writing RHSM custom facts to '/etc/rhsm/facts/convert2rhel.facts'.
BREADCRUMBS_FINISH_COLLECTION has succeeded
[2025-01-24T15:57:52+0000] TASK - [Convert: Remove temporary folder /var/lib/convert2rhel/] **********
Temporary folder /var/lib/convert2rhel/ removed
REMOVE_TMP_DIR has succeeded
[2025-01-24T15:57:52+0000] TASK - [Convert: Post-conversion report] **********************************
========== Success (No changes needed) ==========
(SUCCESS) BREADCRUMBS_FINISH_COLLECTION::SUCCESS - N/A
(SUCCESS) UPDATE_GRUB::SUCCESS - N/A
(SUCCESS) CONVERT_SYSTEM_PACKAGES::SUCCESS - N/A
(SUCCESS) RHSM_CUSTOM_FACTS_CONFIG::SUCCESS - N/A
(SUCCESS) REPLACE_EFI_BOOT_ENTRY::SUCCESS - N/A
(SUCCESS) UPDATE_KERNEL::SUCCESS - N/A
(SUCCESS) NEW_DEFAULT_EFI_BIN::SUCCESS - N/A
(SUCCESS) LIST_NON_RED_HAT_PKGS_LEFT::SUCCESS - N/A
(SUCCESS) INSTALL_RHEL_KERNEL::SUCCESS - N/A
(SUCCESS) MODIFIED_RPM_FILES_DIFF::SUCCESS - N/A
(SUCCESS) KERNEL_BOOT_FILES::SUCCESS - N/A
(SUCCESS) EFIBOOTMGR_UTILITY_INSTALLED::SUCCESS - N/A
(SUCCESS) REMOVE_TMP_DIR::SUCCESS - N/A
(SUCCESS) MOVE_GRUB_FILES::SUCCESS - N/A
(SUCCESS) LOCK_RELEASEVER_IN_RHEL_REPOSITORIES::SUCCESS - N/A
(SUCCESS) CONFIGURE_PKG_MANAGER::SUCCESS - N/A
(SUCCESS) FIX_DEFAULT_KERNEL::SUCCESS - N/A
(SUCCESS) REMOVE_NON_RHEL_KERNELS::SUCCESS - N/A
(SUCCESS) REMOVE_EFI_CENTOS::SUCCESS - N/A
(SUCCESS) CONFIGURE_HOST_METERING_IF_NEEDED::SUCCESS - N/A
(SUCCESS) FIX_INVALID_GRUB2_ENTRIES::SUCCESS - N/A
========== Info (No changes needed) ==========
(INFO) CONFIGURE_HOST_METERING_IF_NEEDED::CONFIGURE_HOST_METERING_SKIP - Did not perform host metering configuration.
Description: Configuration of host metering has been skipped.
Diagnosis: We haven't detected 'configure_host_metering' in the convert2rhel.ini config file nor the CONVERT2RHEL_CONFIGURE_HOST_METERING environment variable.
Remediations: N/A
(INFO) INSTALL_RHEL_KERNEL::RHEL_KERNEL_INSTALL_VERIFIED - RHEL kernel install verified
Description: The RHEL kernel has been verified to be on the system.
Diagnosis: N/A
Remediations: N/A
(INFO) LOCK_RELEASEVER_IN_RHEL_REPOSITORIES::SKIPPED_LOCK_RELEASEVER_IN_RHEL_REPOSITORIES - Skipped releasever lock
Description: Releasever lock is needed only when converting to RHEL EUS using RHSM.
Diagnosis: N/A
Remediations: N/A
(INFO) MODIFIED_RPM_FILES_DIFF::FOUND_MODIFIED_RPM_FILES - Modified rpm files from before and after the conversion were found.
Description: 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
@@ -1,3 +0,0 @@
-S.5....T. c /etc/sysconfig/authconfig
-.M....... /media
-S.5....T. c /etc/ssh/sshd_config
@@ -9,5 +6,3 @@
-.M....... g /boot/initramfs-3.10.0-862.el7.x86_64.img
-.....UG.. /var/www/html
-..5....T. c /etc/yum.repos.d/CentOS-Base.repo
-..5....T. c /etc/yum.repos.d/CentOS-fasttrack.repo
-S.5....T. c /etc/yum/vars/contentdir
+S.5....T. c /etc/sysconfig/authconfig
+.M....... /media
+S.5....T. c /etc/ssh/sshd_config
Diagnosis: N/A
Remediations: N/A
Conversion successful!
WARNING - In order to boot the RHEL kernel, restart of the system is needed.
[2025-01-24T15:57:52+0000] DEBUG - /var/run/lock/convert2rhel.pid PID 6334 unlocked.
Once the conversion is completed, restart your system.
reboot
Verify CentOS to RHEL Migration
Once the system has boot or while it boots, you can confirm from GRUB that it is booting into RHEL.
Once logged in, confirm as well;
hostnamectl
Static hostname: localhost.localdomain
Icon name: computer-vm
Chassis: vm
Machine ID: 6fb3ec89ef6949b090910630b8edb359
Boot ID: 86ecdbf9905f448c99eb4a26daf34c67
Virtualization: kvm
Operating System: Red Hat Enterprise Linux Server 7.9 (Maipo)
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.9:GA:server
Kernel: Linux 3.10.0-1160.el7.x86_64
Architecture: x86-64
Also;
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
Looks good.
If you had any applications running, it is now time to also verify and confirm if they are working as expected.
You can also:
- Register and subscribe your RHEL system
- Remove Convert2RHEL packages and repositories
- Review the list of the third-party packages and remove unnecessary packages from the original OS that remained unchanged (
yum list extras --disablerepo="*" --enablerepo=RHEL_REPO_ID
) - Upgrade RHEL to the latest releases e.g from RHEL 8 to RHEL 9.
You can also explore other methods of conversion:
And that closes our guide on CentOS to RHEL Migration with the Convert2RHEL Tool.
Other RHEL related tutorials