0% found this document useful (0 votes)
301 views19 pages

How To Convert CentOS 7 Linux To RHEL 8 Server

The document provides steps to convert a CentOS 7 Linux server to RHEL 8. It details prerequisites for conversion like backing up the system. The conversion is done using the Convert2RHEL utility which replaces CentOS packages with RHEL equivalents. The process involves updating packages, installing the utility, and registering the system with RHEL credentials.

Uploaded by

Perico Martinez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
301 views19 pages

How To Convert CentOS 7 Linux To RHEL 8 Server

The document provides steps to convert a CentOS 7 Linux server to RHEL 8. It details prerequisites for conversion like backing up the system. The conversion is done using the Convert2RHEL utility which replaces CentOS packages with RHEL equivalents. The process involves updating packages, installing the utility, and registering the system with RHEL credentials.

Uploaded by

Perico Martinez
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

https://techviewleo.

com/how-to-convert-centos-7-linux-to-rhel-8-server/

How To Convert CentOS 7 Linux To


RHEL 8 Server
April 13, 2022 Modified date: April 13, 2022

Hello everyone and welcome to today’s guide on how to migrate CentOS 7 Linux to
RHEL 8 Server. CentOS 7 will reach its EOL on 30th June 2024, necessitating
converting to a stable and secure RHEL 8. CentOS is the community version of RHEL.

RHEL 8 is a more stable and secure OS that allows developers to use the latest tools and
packages available in the market for managing their OS. CentOS Linux 8 reached its
end of life on 31st December 2021 and its users will be required to migrate to CentOS
Stream 8. Conversion from CentOS Stream to RHEL is not currently supported.

This, therefore, calls for migration from CentOS 7 to RHEL to continue enjoying the
support from the community and also get to enjoy the use of the latest tools and package
updates. With RHEL, you are able to address any issues or bugs for better experience
and productivity.

For you to follow through with the guide, I assume you already have your CentOS 7
Linux machine which you intend to migrate to RHEL 8, and a superuser account. Let’s
now fold our sleeves and get started.

The process of conversion is done on a running system via a tool called


Convert2RHEL utility. This is the official RedHat utility tool to aid in conversion to
any RedHat distribution. This tool replaces all the CentOS RPM files with their
equivalent version in RHEL. If there exists other third-party software or packages that
do not have corresponding RHEL repositories, those particular packages remain
unchanged during conversion.

PREPARING FOR A RHEL CONVERSION

For successful conversion ensure you have the following prerequisites.

Pre-requisites

 Verify your system is supported for conversion.


 Stop important applications on CentOS 7 e.g database services
 Its needful to do a backup of your system.
 Disable antivirus program if at all its installed.

Lets now begin the process of conversion:


Before you carry the steps below, please take a backup of your system. You can do a
snapshot of the system so that you can always revert back in case of any failure. Then
ensure your system is supported for conversion and that the standard kernel is the
booted kernel i.e CentOS Linux or Oracle Linux.

From the official RedHat website, It is possible to convert from CentOS Linux 7 to Red
Hat Enterprise Linux 7. In this article, we will convert from CentOS Linux 7 to Red Hat
Enterprise Linux 7 and then from Red Hat Enterprise Linux 7 to Red Hat Enterprise
Linux 8.

Step 1: Update your YUM packages

Update your system to refresh Yum packages prior to beginning the conversion process.

sudo yum update -y

Check Kernel release :

$ uname -r
3.10.0-1160.45.1.el7.x86_64

Confirm RedHat release:

$ cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

Reboot your server after the upgrade:

sudo reboot
Step 2 : Install Convert2RHEL Utility

Once the packages are refreshed and the YUM index updated, install the
Convert2RHEL utility tool.

1 ) Download Red Hat RPM Signing GPG key

sudo curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release


https://www.redhat.com/security/data/fd431d51.txt

2 ) Download the SSL certificate of the server that contains


the Convert2RHEL repositories

sudo curl --create-dirs -o /etc/rhsm/ca/redhat-uep.pem


https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem

3 ) Install Convert2RHEL repository file

sudo curl -o /etc/yum.repos.d/convert2rhel.repo


https://ftp.redhat.com/redhat/convert2rhel/7/convert2rhel.repo

4 ) Install Convert2RHEL utility tool.

This is the tool that helps in conversion to Red Hat distributions.

sudo yum -y install convert2rhel

Sample output:

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

Dependency Installed:
pexpect.noarch 0:2.3-11.el7

Complete!

This will install convert2rhel and its dependencies.

For conversion to be successful, you must have the latest version of the Convert2rhel
Utility installed in the system.
Red Hat Satellite server

If RHEL packages are accessed through the Red Hat Satellite server, you need to
download the RPM packages to the /usr/share/convert2rhel/subscription-manager/
directory and download the katello-ca-consumer-latest package from the Satellite
server.

curl --insecure --output /usr/share/convert2rhel/subscription-


manager/katello-ca-consumer-latest.noarch.rpm
https://satellite.example.com/pub/katello-ca-consumer-
latest.noarch.rpm

Replace the Satellite’s server’s hostname i.e satellite.example.com with your Satellite
server’s hostname.
Step 3 : Convert CentOS 7 to RHEL 7
In this step, we will convert CentOS7 to RHEL7 before migrating to RHEL8. This is
because RHEL8 requires dnf-utils which are not supported by CentOS7 and hence cant
be installed in CentOS 7.

There are two methods of registering and subscribing to your system during the
conversion.

1 ) Provide the organization ID and activation key. This method is preferred when
multiple systems are to be converted. This method must be used when accessing RHEL
packages using Satellite through RHSM (Red Hat Subscription Manager).

2 ) Provide the username, password, and pool ID. Users accessing RHEL packages
using Red Hat CDN through RHSM can use this method.

Let’s begin the process of converting.

1 ) Begin by updating your system.

sudo yum update -y

2 ) Start the Convert2RHELutility, then Convert CentOS 7 to RHEL 7 Server with


Organization ID and activation key.

sudo convert2rhel --org organization_ID --activationkey activation_key

Replace the organization_ID and activation_key with the organization ID and activation
key from the Red Hat Customer Portal if you are using Red Hat CDN or the Satellite
web UI if you are using Red Hat Satellite.

If you are accessing RHEL packages using Satellite, you must use the organization ID
and activation key to run the convert2rhel command.

If you are accessing RHEL packages using Satellite and your system has no internet
access, add the --keep-rhsm option. You must have the subscription-
manager and katello-ca-consumer packages already installed and must provide your
organization ID and activation key when running the convert2rhel command.

For example:

sudo convert2rhel --org TestOrganization --activationkey RHEL7_Server

In the command, the organization_ID is TestOrganization and the activation_key is


RHEL7_Server
3 ) With the username, password, and pool ID:

The syntax is as below:

sudo convert2rhel --username username --password 'password' --auto-


attach

Replace username and password with your Red Hat Account credentials. See the below
example:

sudo convert2rhel --username computingforgeeks --password


'RedHatAccountPassword' --auto-attach

If using pool ID, the command syntax is:

sudo convert2rhel --username username --password password --pool


pool_ID

Where:

 pool_ID is replaced with the pool ID of the subscription that you want to attach
to the system. If you are not sure about the pool_ID omit the –pool option.

In this article, I will use the second option where I will provide the username and the
password. I will use my RedHat username. I will skip the password bit intentionally to
provide it later during the conversion process.

Sample output:

Conversion-Initialization-process
The backup will be done automatically as below:

system-backup-prior-to-conversion

As the process progresses, you will be prompted to read the license agreement as well
as agree to several prompts by answering with a y.

Process-prompts-you-to-continue-with-conversion
Once you agree, the backup will be done and unwanted packages removed while
installing the RHEL packages necessary for conversion.

backup, removal of unwanted packages & installation of wanted packages

The next prompt will be to supply the RHEL password for the user.

Enter-RHEL-password-for-the-user

Once you supply the correct password, registering the system using the subscription
manager will be initiated. The process will continue and the next prompt is to Enter the
number of the chosen subscription. I will choose Subscription number 2 which is Red
Hat Developer Subscription for Individuals and provides Red Hat Developer Tools (for
RHEL Server for ARM) among others.
It’s good to note that every Subscription number has its own pool ID. Enter 2 as your
chosen subscription and press Enter.

choose-subscription-number

The next prompt will be to Continue with the system conversion. Say y and press
Enter.

Continue-with-conversion-prompt

More prompts to continue with conversion: Agree to the prompt by y and press Enter.

continue-with-system-conversion
The process of conversion will take some time depending on the speed of your internet,
your CPU, and your memory resources.

This is what my status of conversion looks like :

Transaction Summary
======================================================================
==========
Install 1 Package (+3 Dependent packages)
Reinstall 1317 Packages
Not available 53 Packages

Total download size: 908 M


Installed size: 3.2 G
Downloading packages:

Once the conversion is finished, you should see a similar message:

conversion-successful

After conversion reboot the system to boot the RHEL kernel.

sudo reboot now

Step 4 : Tests and Confirmations of successful conversion

Once the process of conversion is complete, you need to ascertain that conversion was
actually successful.

Confirm that your system is running on RedHat Enterprise Linux 7 by this command.

$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)

Check the Kernel version.

$ uname -r
3.10.0-1160.49.1.el7.x86_64

Conversion to RHEL 7 was successful. In the following steps, we will convert RHEL 7
to RHEL 8.
Step 5 : Upgrading from RHEL 7 to RHEL 8.

This article assumes you already have RHEL 7 running in your system or have
converted your system to RHEL by following the steps above.

To upgrade from RHEL 7 to RHEL 8, we use a utility called Leapp Utility.

1 ) Verify that you have Red Hat Enterprise Linux Server Subscription attached.

Run the command:

$ sudo subscription-manager list --installed


+-------------------------------------------+
Installed Product Status
+-------------------------------------------+
Product Name: Red Hat Enterprise Linux Server
Product ID: 69
Version: 7.9
Arch: x86_64
Status: Subscribed
Status Details:
Starts: 05/25/2021
Ends: 05/25/2022

2 ) Ensure you have appropriate repositories enabled.

Enable the Base repository:

$ sudo subscription-manager repos --enable rhel-7-server-rpms


Repository 'rhel-7-server-rpms' is enabled for this system.

Enable the Extras repository and its dependencies:

$ sudo subscription-manager repos --enable rhel-7-server-extras-rpms


Repository 'rhel-7-server-extras-rpms' is enabled for this system.

3 ) Set the RHSM to consume the latest RHEL 7 content.

$ sudo subscription-manager release --unset


Release preference has been unset

4 ) Update your system and reboot.

sudo yum update -y


sudo reboot now

5 ) Install Leapp Utility:

sudo yum install leapp-upgrade

The output:

Installed:
leapp-upgrade-el7toel8.noarch 0:0.15.0-6.el7_9
Dependency Installed:
dnf.noarch 0:4.0.9.2-2.el7_9
dnf-data.noarch 0:4.0.9.2-2.el7_9
leapp.noarch 0:0.13.0-1.el7_9
leapp-deps.noarch 0:0.13.0-1.el7_9
leapp-upgrade-el7toel8-deps.noarch 0:0.15.0-6.el7_9
libcomps.x86_64 0:0.1.8-14.el7
libdnf.x86_64 0:0.22.5-2.el7_9
libmodulemd.x86_64 0:1.6.3-1.el7
librepo.x86_64 0:1.8.1-8.el7_9
librhsm.x86_64 0:0.0.3-3.el7_9
libsolv.x86_64 0:0.6.34-4.el7
python2-dnf.noarch 0:4.0.9.2-2.el7_9
python2-hawkey.x86_64 0:0.22.5-2.el7_9
python2-leapp.noarch 0:0.13.0-1.el7_9
python2-libcomps.x86_64 0:0.1.8-14.el7
python2-libdnf.x86_64 0:0.22.5-2.el7_9

Complete!

Leapp and its dependencies are successfully installed. Ensure the latest version of Leapp
is installed for successful conversion.

6 ) Review the upgrade report by running this command:

sudo leapp preupgrade

The output:

Leapp-pre-upgrade-report

The pre-upgrade report is available both on the web console (.json file) or as text (.txt)
in the /var/log/leapp/leapp-report.json and /var/log/leapp/leapp-
report.txt respectively.

To read the contents of the text file :

sudo cat /var/log/leapp/leapp-report.txt | less


To check on the suggested solutions on how to proceed, view the
/var/log/leapp/answerfile

You can choose to manually follow the recommendations on the /var/log/leapp/leapp-


report.txt file or use the web console to review the report, apply automated remediations
where available, and fix remaining problems using the suggested remediation hints
through the /var/log/leapp/leapp-report.json

Analyze the report before proceeding. See more information about these two methods
here

In my case the question is Disable pam_pkcs11 module in PAM configuration from


the leapp-report.txt. There are two ways to solve this.

1. Using a text editor, to manually edit the /var/log/leapp/answerfile and edit it as


shown in the screenshot.

uncomment-the-confirm-section

All you need to do is uncomment the confirm line of the file by deleting the # symbol,
and confirm your answer as True.

2 ) . You can achieve the same outcome by running the command below:

# leapp answer --section remove_pam_pkcs11_module_check.confirm=True

Another inhibitor : Upgrade has been inhibited due to the following problems:
Possible problems with remote login using root account . To solve this problem ,
Enable PermitRootLogin into the /etc/ssh/sshd_config file. This is done by deleting
the # symbol as shown below.

Permit-Root-Login
Then start the service:

sudo systemctl restart sshd

Then finally i had to set the SELinux to permissive from enforcing by editing the
selinux config file.

sudo vim /etc/selinux/config

Its also important i mention that you need to download Leapp utility metadata in-place
upgrades of RHEL for disconnected upgrades. The latest metadata file from the official
redhat site is leapp-data15 . All you need to do is manually download the file into
/etc/leapp/files/ and extract it. This file is available here. You will see the file towards
the end of the article. When all is set , run the leapp preupgrade command.

sudo leapp preupgrade

If you get this output, you are ready for the upgrade.

Ready-For-Upgrade

From the screenshot, i dont have anymore errors.

Step 6 : Performing the upgrade from RHEL 7 to RHEL 8

On your RHEL 7 system, start the upgrade process by running this command

sudo leapp upgrade

The process of upgrade takes time as thousands of packages are installed. please be
patient and give it some time. You will be required to reboot your system during the
upgrade process.
Once you reboot, The upgrade process will continue. See a snapshot of the process
below.

upgrade-snapshot

At this point ,i recommend you take a book and read as this process will take long
depending on internet resources and speed.

Once the process completes, the system boots as shown in the screenshot. Notice the
kernel version has changed to 4.18

Kernel-version-4.18.0
From the output we can deduce that we are on RHEL 8.4 0otpa. The system boots like
this .

RHEL-8-interface
Step 8 : Post installations tweaks
Lets confirm what our Redhat release is .

$ cat /etc/redhat-release
Red Hat Enterprise Linux release 8.4 (Ootpa)

Check the OS kernel version.

$ uname -r
4.18.0-305.25.1.el8_4.x86_64

Verify the release version.

$ subscription-manager release
Release: 8.4

Verify that correct product has been installed.

$ sudo subscription-manager list --installed


[sudo] password for jil:
+-------------------------------------------+
Installed Product Status
+-------------------------------------------+
Product Name: Red Hat Enterprise Linux for x86_64
Product ID: 479
Version: 8.4
Arch: x86_64
Status: Subscribed
Status Details:
Starts:
Ends:

Change Hostname

#check current hostname


$ hostname -f
rhel-7

$ sudo hostnamectl set-hostname rhel-8

$ hostname -f
rhel-8

step 9 : Post-Upgrade Tasks


Perform the following tasks.

A ) Remove any remaining Leapp packages from exclude list in the /etc/dnf/dnf.conf
configuration file.

$ sudo dnf config-manager --save --setopt exclude=''


Updating Subscription Management repositories.
B ) Remove remaining RHEL 7 and Leapp packages.

$ sudo rpm -qa | grep -e '\.el[67]' | grep -vE '^(gpg-pubkey|katello-


ca-consumer)' | sort

cockpit-leapp-0.1.6-2.el7_9.noarch
flite-1.3-22.el7.x86_64
kernel-3.10.0-1160.59.1.el7.x86_64
kernel-3.10.0-1160.el7.x86_64
leapp-0.13.0-1.el7_9.noarch
leapp-upgrade-el7toel8-0.15.0-6.el7_9.noarch
libchamplain-0.12.16-2.el7.x86_64
libchamplain-gtk-0.12.16-2.el7.x86_64
libIDL-0.8.14-8.el7.x86_64
python2-leapp-0.13.0-1.el7_9.noarch
ustr-1.0.4-16.el7.x86_64

C ) Check old kernel version.

$ cd /lib/modules && ls -d *.el7*


3.10.0-1160.59.1.el7.x86_64 3.10.0-1160.el7.x86_64

D ) Remove weak modules from the old kernel.

$ sudo [ -x /usr/sbin/weak-modules ] && /usr/sbin/weak-modules --


remove-kernel <version>

# Example
sudo [ -x /usr/sbin/weak-modules ] && /usr/sbin/weak-modules --remove-
kernel 3.10.0-1160.59.1.el7.x86_64 3.10.0-1160.el7.x86_64

E ) Remove old kernel from the bootloader entry.

$ sudo /bin/kernel-install remove <version> /lib/modules/


<version>/vmlinuz
sudo /bin/kernel-install remove 3.10.0-1160.59.1.el7.x86_64 3.10.0-
1160.el7.x86_64 /lib/modules/3.10.0-1160.59.1.el7.x86_64 3.10.0-
1160.el7.x86_64/vmlinuz

F ) Unset RHSM to consume the latest RHEL 8.5 content.

$ sudo subscription-manager release --unset


Release preference has been unset

G ) Update your system

sudo yum update

Conclusion
Congratulations , your system has successfully been converted from CentOS 7 Linux
Machine To RHEL 8 Server. I hope you have learnt something new. The article is quite
lengthy but worth it. Please carry out the steps keenly and seek to understand every step.
If you love what we do, please buy us a coffee. It makes us stay awake at night as we do
our research. Please leave a comment below and dont hesitate to ask any question.
See more resourceful:

 How To Convert From CentOS 7 To AlmaLinux 8


 How To Convert Arch Linux To BlackArch Linux
 How To Convert From CentOS 7 To CentOS Stream 8
 How To Migrate CentOS 8 Server to Oracle Linux 8
 Easily Migrate from CentOS 8 To Rocky Linux 8

You might also like