Migrate CentOS to Oracle Linux — an approach

Sathya
Oracle Developers
Published in
5 min readJan 25, 2021

CentOS announced (https://blog.centos.org/2020/12/future-is-centos-stream) they will focus on releasing the CentOS Stream, which will get features ahead of Redhat Enterprise Linux.

Why is that an issue?

Mainly because of CentOS's stability in the past, Redhat looks to release the CentOS Stream features to users before it actually gets it to main Redhat Enterprise Linux. (read more https://www.zdnet.com/article/red-hat-resets-centos-linux-and-users-are-angry/)

This is a big hit for CentOS users, and when customers are not happy, such decisions will lead to opportunities for them to explore what works best for them like earlier.

This can be something like how the “Whatsapp” app customers are moving to other apps like “Telegram” and “Signal” at a rapid rate. Customer is the centerpiece in every organization.

CentOS Migration

It’s a tedious decision-making process if you have not experienced other Linux flavors like RHEL (Redhat Enterprise Linux) or Oracle Linux. There are various pros and cons of each of them, and many debates land into a more application-specific decision. (read more https://www.centroid.com/blog/oracle-linux-vs-red-hat-enterprise-linux/)

Oracle Linux is free and pay only if you need Oracle Linux Support. Yes, that’s what you just read. Oracle offers Linux with great features like DTrace, Ksplice in their Linux for free (GNU GPL). (read more if you need enterprise support https://blogs.oracle.com/wim/oracle-linux-and-oracle-vm-pricing-guide)

Customers moving to Oracle Cloud Infrastructure (OCI) (Generation 2 Cloud) from the data center or another cloud provider or Oracle OCI-Classic (OCI-C) can consider converting CentOS to Oracle Linux. Oracle Linux Support is included in the OCI subscription. (https://docs.oracle.com/en-us/iaas/Content/home.htm)

A simple trend comparison of Redhat Linux vs. Oracle Linux — raw statistics from Google Trends.

Trends of Oracle Linux and Redhat Linux — the USA only
Trends of Oracle Linux and Redhat Linux — Worldwide

Understand the limitations and known issues of migration:

Being aware of any solution's limitations is a key factor in determining if the solution can be scaled for the enterprise.

  • If there are subscription-manager like Foreman/Katello, those cannot be moved along with this migration yet.
  • CentOS 8.3 with open-JDK installed, we need to follow a workaround to do a backup of “alternatives –list” and then restore the missing links manually with “alternatives –install.”

Review more at https://github.com/oracle/centos2ol/issues

Methodology Overview

The first step -001, take a backup! create a snapshot (or required backup) of the root storage device (and or other volumes) before starting this exercise

Typical migration approach

The next step is to run the script developed by Oracle (https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh). This automated conversion process is performed on a running system(with sufficient backup to recover). The utility replaces all RPM packages from the original Linux distribution with the respective Oracle Linux version. At the end of the process, it is necessary to restart the system to boot the Oracle Linux kernel.

https://raw.githubusercontent.com/oracle/centos2ol/main/README.md

OPTIONS
-r Reinstalls all CentOS RPMs with Oracle Linux RPMs
-V Verify RPM information before and after the switch

Below is a quick step-by-step approach for migrating from CentOS to Oracle Linux.

In the below scenario, I would be highlighting the steps to migrate from Oracle Public Cloud (Classic-Gen1) to Oracle Cloud Infrastructure (Gen2) using opcmigrate (read more at https://docs.oracle.com/en/cloud/iaas-classic/compute-iaas-cloud/migrate-oci/migrate-vms-and-block-storage.html)

Migrate + Shift to Oracle Cloud Infrastructure Options

Option 1— Migrate the CentOS servers to Oracle Linux using centos2ol.sh, then move to Oracle Cloud Infrastructure (Gen2) with opcmigrate

Option 2— Migrate the CentOS servers as CentOS to OCI using opcmigrate (skip this step if you are not migrating) —

In both options, you will need to follow the same steps as for Linux migration except the below change (https://docs.oracle.com/en/cloud/iaas-classic/compute-iaas-cloud/migrate-oci/migrate-vms-and-block-storage.html#GUID-3512AB58–9106–47B2–96B2–68CE7F19886C)

Remember in the hosts.yml remember to change the “remote_user” value to “centos”

Ensure the source REPO is updated to vault.centos.org(similar to shown below) archive and update the existing CentOS packages to the latest before the centos2ol.sh is run.

# CentOS-Base.repo[base]
name=CentOS-$releasever — Base
baseurl=https://vault.centos.org/6.10/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#released updates[updates]
name=CentOS-$releasever — Updates
baseurl=https://vault.centos.org/6.10/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
#additional packages that may be useful[extras]
name=CentOS-$releasever — Extras
baseurl=https://vault.centos.org/6.10/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

If you need to remove CentOS GPG keys from the trust store, use the option -r when the centos2ol.sh is run.

I did test CentOS 6 , CentOS 7 & CentOS 8 with both Option1 & Option2.
Both worked well, except for a few known issues with CentOS 8. Also, note that the CentOS6 (oldest kernel of the three) migrated as PV(Paravirtualized) to Oracle Cloud Infrastructure to get optimum performance benefits.

Kernel-Version Migration with status

Execution

$wget https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh--2021-01-12 15:56:58--  https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh
Resolving raw.githubusercontent.com... 199.232.64.133
Connecting to raw.githubusercontent.com|199.232.64.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 20588 (20K) [text/plain]
Saving to: “centos2ol.sh”
100%[==================================================================================================================================================================>] 20,588 --.-K/s in 0s
2021-01-12 15:56:58 (53.5 MB/s) - “centos2ol.sh” saved [20588/20588]
$sudo bash centos2ol.shChecking for required packages...
Checking your distribution...
Checking for yum lock...
Checking for required python packages...
Finding your repository directory...
Learning which repositories are enabled...
...
<<Output Truncated>>
...
Complete!
Sync successful. Switching default kernel to the UEK.
Removing yum cache
Switch complete. Oracle recommends rebooting this system.
$sudo reboot

References:

Issues on centos2ol script:
https://github.com/oracle/centos2ol/issues

Sample output of CentOS8 to Oracle Linux 8 screen output
https://objectstorage.us-ashburn-1.oraclecloud.com/n/ocicpm/b/blog-output/o/centos8_to_ol8.txt

Good Read if you are doing mass migration not specific to Oracle Cloud:
http://www.softpanorama.org/Commercial_linuxes/Oracle_linux/conversion_of_centos_to_oracle_linux.shtml

Future of CentOS:
https://centos.org/distro-faq/#question-1-what-is-the-future-of-centos

Oracle Linux References:
https://linux.oracle.com/switch/centos/
http://www.oracle.com/us/technologies/linux/oracle-linux-ds-1985973.pdf
http://www.oracle.com/us/technologies/027615.pdf
https://blogs.oracle.com/scoter/switch-from-centos-to-oracle-linux-example
https://blogs.oracle.com/linux/

Other Useful References:
https://www.centroid.com/blog/oracle-linux-vs-red-hat-enterprise-linux/
https://linuxhint.com/oracle_linux_vs_redhat/
https://en.wikipedia.org/wiki/Oracle_Linux

--

--

Sathya
Oracle Developers

Lead Architect @ somewhere, Views here are my own only.