How to Migrate CentOS Linux 6, 7, 8 servers to Oracle Linux

Centos Linux 8 server or desktop which would be out of the shelf by the Redhat next year becomes a topic of apprehension for some users or administrators. However, those are on CentOS 7 they don’t have to worry yet because still, there is a time, as it will reach to end of its life in 2024.

Well, one of the popular alternatives which are available to switch the CentOS 6 or 8 is the Oracle Linux, which is free and works with the same binaries used by the CentOS after all both are RPM-based and descendent of Redhat.

If you are worried about your installed applications and packages on CentOS 8/7/6 Linux in the process of migration then you don’t have too much because most of them will be intact as they are, even after switching to Oracle Linux.

Let’s talk a little bit about Oracle Linux, it is free to download, use, and distribute (even source code) operating system based on RedHat that’s why it is compatible with most of the binaries of RHEL or CentOS. Even enterprises can use it in a production environment free of cost without any obligation from Oracle. With every major release of  Red Hat Enterprise Linux (RHEL), Oracle also released its own therefore the latest version of Oracle Linux is 8 which in CentOS about to end in 2021.

The updates released by the RedHat, usually available on Oracle Linux within five days, claimed by the Oracle.  While migrating the users can choose the kernel of their choice supported by Oracle, well there are two, one is the popular Unbreakable Enterprise Kernel (UEK) for Oracle Linux and the other is the Red Hat Compatible Kernel (RHCK).

We can choose what kernel should be there once the migration process will be completed. Let’s see the steps.

Steps to Migrate CentOS 8/7/6 Linux to Oracle Linux

As CentOS 7 maintain its cycle with the LTS version of RHEL 7. Thus migration of that is out of the question. Therefore, only two kinds of users will be interested in this, one who is on 6 or 8 versions of CentOS. Here, we are using CentOS 8 Linux for doing this tutorial, however, the steps will be applicable for all three versions 6,7 & 8. For more information on this, you can go through the official GitHub Page of Oracle.

Pre-requisites:

  • Yum or DNF should be in a working configuration
  • There should no old repository which is not in use anymore.
  • Ensure you have at least 5GB of free space in /var/cache
  • sudo privileges.

Note: You can even –Migrate your CentOS 8 Linux to CentOS Stream

1. Run system update && upgrade command

First, run the system update and upgrade command which will not only update all installed packages on your CentOS Linux but also let them achieve their latest state.

sudo yum update

2. Download Oracle Script to Migrate to CentOS Linux

The below-given command will download a script to smoothly migrate from CentOS without much hassle with commands and all.

curl -O https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh

3. Run the script

The migration script which we have downloaded from GitHub, here we are going to run the same, it will automatically identify the system and switch CentOS Linux 6, 7, or 8 to the equivalent version of Oracle Linux. I mean CentOS 7 to Oracle 7, CentOS 8 to Oracle 8.

sudo bash centos2ol.sh

Wait for few minutes to hours, depending upon the applications installed on the existing system that you are intending to migrate, the process will take time. The script will not only SWAP the repository of CentOS with Oracle but also reinstall the packages to make them compatible.

4. Migration is done… Check available kernels

Once the switching from CentOS Linux Oracle will be done, the notification for the same will appear on the command terminal screen.

Migrate CentOS 8 Linux to Oracle 8

As the process will also install the Unbreakable Enterprise Kernel -UEK by default for the CentOS we have just migrated. So to check all the available Kernels and which one is the default.

sudo grubby --info=ALL | grep ^kernel

The above command will list all the available kernels.

To see the default one, run

sudo grubby --default-kernel

And the default one will be UEK from Oracle.

(Opiotnal) in case you want to change that with any of the other available ones then run:

sudo grubby –info kernel-version index=1

Replace kernel-version with the available one such as

  • /boot/vmlinuz-4.18.0-240.1.1.el8_3.x86_64
  • /boot/vmlinuz-4.18.0-240.8.1.el8_3.x86_64
  • /boot/vmlinuz-4.18.0-147.8.1.el8_8.x86_64

 

Check available Kernels

5. Reboot the system and check Oracle Linux version

Once, all the above-needed things are done, simply reboot your system. The command for that is

reboot

Login system

Swtich CentOS to Oracle Linux

Login and run the command to check which version of Oracle Linux is on our system

cat /etc/os-release

In our case, the result was:

NAME= "ORACLE Linux Server"
VERSION="8.3"
ID="ol"
ID LIKE="fedora"
VARIANT="Server"
VARIANT_ID="8.3"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.3"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracale.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.3
ORACLE_SUOPPORT_PRODUCT="Oracle Linux"
ORACLE_SUOPPORT_PRODUCT_VERSION=8.3

Check Linux version

 

Other Articles:

 

1 thought on “How to Migrate CentOS Linux 6, 7, 8 servers to Oracle Linux”

  1. This script errors out. First yum is gone from my centos 8 install so I manually changed everything to dnf. Now i am halting “No package oraclelinux-release available.” on the download. Suggestions? I would like to make this script work as I have a dozen servers to upgrade

    Reply

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.