DEV Community

Cover image for Transform CentOS to Oracle Linux in 2 Easy Steps
Andrew Pazikas
Andrew Pazikas

Posted on • Originally published at pazikas.com

Transform CentOS to Oracle Linux in 2 Easy Steps

I’ve been meaning to write an article on how to switch from CentOS to Oracle Linux for a while since Red Hat owned by IBM announced its new direction for CentOS, I’ve found myself with a bit of spare time over the weekend so finally got around to documenting the steps required to migrate from CentOS to Oracle Linux.

What is CentOS?

CentOS (Community Enterprise Operating System) was a Linux distribution that provided a free, community-supported computing platform functionally compatible with its upstream source,
Red Hat Enterprise Linux in January 2014, CentOS announced the official joining with Red Hat while staying independent from RHEL under a new CentOS governing board. The first CentOS release in May 2004, numbered CentOS version 2, was forked from RHEL version 2.1AS with the most recent version being CentOS 8 released on 24 September 2019.

Why Switch?

In December last year, Red Hat announced that CentOS that the availability of CentOS undermines the commercial side of its business with CentOS becoming CentOS Stream, which is is a development preview of what is soon to come in Red Hat Enterprise Linux, focused on the next minor release. Fedora another distribution maintained by Red Hat is further ahead and more experimental than what CentOS will become.

In the past, CentOS has been a community build of the current RHEL source, providing a robust production distro for those willing to do without Red Hat support. When RHEL gets a fix, the project aims to have the same fix available for CentOS “within 72 hours” of its release, while new point releases of CentOS come “four to eight weeks after the release by upstream.” In other words, CentOS tracked RHEL. But with this new update, the direction changes making CentOS a more experimental OS rather than the stable distro capable of production workloads.

Oracle Linux

Not Oracle you say why move away from one corporate overload (IBM owns Red Hat) and jump in the pan with another (Oracle)?
CentOS to Oracle Linux

Oracle Linux much like what CentOS does tracks the RHEL base release and bar Oracles Unbreakable Kernal is pretty much a direct clone of Red Hat with some Oracle branding slapped over the Red Hat stuff. Oracle previously posted about it here and to alleviate some concerns provides an FAQ.
Switching from CentOS to Oracle Linux

Switching from CentOS to Oracle Linux couldn’t be easier, Oracle provides a lovely shell script to do all the hard work for you, you can get it from their GitHub. Let’s demo the process below. I’ve used a CentOS 7 Vagrant host to perform the process which you can manually download yourself here or if you are already using Vargant just follow the steps below. I’ve written about Vagrant before if you are interested.

Let's get the vagrant CentOS 7 vagrant file and start the machine;

vagrant init centos/7
vagrant up

With CentOS 7 installed let's install git and ensure all the packages are up-to-date;

[vagrant@localhost ~]$ cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

sudo yum install git
sudo yum update && sudo yum upgrade -yum

Get Oracle’s script to swap the OS from CentOS to Oracle Linux

git clone https://github.com/oracle/centos2ol.git

Run the centos2ol.sh script;

[root@localhost centos2ol]# ls
centos2ol.sh CONTRIBUTING.md LICENSE.txt README.md SECURITY.md
[root@localhost centos2ol]# ./centos2ol.sh

It doesn't take long at all to do the changes, my example took about 5 minutes to run. Below I have posted an extract of the logs

[root@localhost centos2ol]# ./centos2ol.sh
Checking for required packages...
Checking your distribution...
package epel-release is not installed
Checking for yum lock...
Checking for required python packages...
Finding your repository directory...
Learning which repositories are enabled...
Repositories enabled before update include:
base
extras
updates

...
...

Looking for yumdownloader...
Backing up and removing old repository files...
Removing CentOS-specific yum configuration from /etc/yum.conf
Downloading Oracle Linux release package...
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

...
...
...

done
Removing yum cache
Switch complete. Oracle recommends rebooting this system.

After a reboot of the host, we see we have successfully moved from CentOS to Oracle Linux

[vagrant@localhost ~]$ uptime
12:31:05 up 0 min, 1 user, load average: 1.17, 0.42, 0.15
[vagrant@localhost ~]$ cat /etc/redhat-release
RedHat Enterprise Linux Server release 7.9 (Maipo)
[vagrant@localhost ~]$ cat /etc/oracle-release
Oracle Linux Server release 7.9

Other Options

Another option is to wait on Rocky Linux, after the news broke Gregory Kurtzer, the founder of the CentOS project who had been out of the scene for a few years would return and create Rocky Linux with the goal of building a community enterprise operating system designed to be 100 percent bug-for-bug compatible with Red Hat Enterprise Linux. This is great news but it’s likely to be a year or two away at the earliest, you can help out with Rocky Linux and track updates on their website here.

Cloud Linux OS made a similar announcement as well that it would also work on making a CentOS/Red Hat clone called AlmaLinux. Both Rocky Linux and AlmaLinux are still developing their respective operating systems but Alma already has a working Beta which you can check out here.

Conclusions

Whether you like Oracle or not they have provided a viable way to move from CentOS to Oracle Linux as Red Hat starts to utilize CentOS for experimental features do you really want production hosts running on such a distro?

Top comments (0)