How to Migrate from CentOS to Oracle Linux

With the shift in focus from CentOS project to CentOS Stream which will now serve as the upstream to RHEL, a few CentOS alternatives have been floated to replace CentOS 8.

For while now CentOS has been widely used by small businesses and developers in server environments given that it provides the stability and reliability that RHEL offers at absolutely no cost. Being a rolling release and a Beta version for future RHEL releases, CentOS Stream will certainly not be recommended for production workloads.

A few alternatives have been floated as worthy alternatives. AlmaLinux has emerged as a viable candidate being 1:1 binary compatible with RHEL. We have covered how you can migrate from CentOS 8 to AlmaLinux 8.4. The other recommended alternative is Oracle Linux which is 100% compatible with RHEL. This means the applications and features remain the same for Oracle Linux.

In this guide, we walk you through the migration of CentOS to Oracle Linux.

CAUTION:

The switch from CentOS 8 to Oracle Linux went along smoothly in our case, However, we cannot guarantee with certainty that the same will be replicated in your case.

As a precaution, we advise you to perform a complete backup of all your files before you start the migration. In addition, ensure that you have a fast and stable internet connection to update your system packages and download the latest Oracle Linux packages.

That said, follow the steps below to start your migration.

Migrating from CentOS to Oracle Linux

First off, log in to your CentOS system and upgrade it to the latest current release. At the moment, the latest CentOS release is CentOS 8.4.

$ sudo dnf update
Update to CentOS 8.4
Update to CentOS 8.4

The upgrade will take quite a while, and will for the most part depend on your internet connection. The faster your internet connection, the faster the upgrade will be.

Then check if your system has been upgraded to the latest version as shown.

$ cat /etc/redhat-release
Check CentOS Version
Check CentOS Version

Next, download and run the migration script is available from Github to help you switch from your CentOS instance to Oracle Linux. It performs a couple of operations including removing any CentOS-specific packages and replacing them with the Oracle Linux equivalent. At the moment, the script supports CentOS 6, 7, and 8 releases and does not support CentOS Stream.

To download the script, run the curl command as shown.

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

This downloads the migration script called centos2ol.sh as indicated.

Download CentOS to Oracle Linux Migration Script
Download CentOS to Oracle Linux Migration Script

Next, assign execute permissions using the chmod command.

$ chmod +x centos2ol.sh

To start the migration run the script as shown.

$ sudo bash centos2ol.sh

As mentioned earlier, the script performs a number of operations. It first checks if all the required packages needed during the upgrade are present and installs the missing ones.

CentOS to Oracle Linux Migration Process
CentOS to Oracle Linux Migration Process

It then proceeds to back up and obsolete old CentOS repository files.

Backup Old CentOS Repositories
Backup Old CentOS Repositories

Next, it enables the Oracle Linux App stream and Base OS repositories and removes the CentOS equivalent ones.

Enable Oracle Linux Repositories
Enable Oracle Linux Repositories

After switching to Oracle Linux repositories, it syncs with the online repositories and upgrades the Oracle Linux packages. It will also reinstall some packages.

Syncing with Online Oracle Repositories
Syncing with Online Oracle Repositories

The entire process is quite long, and you may want to give yourself at least 2 – 3 hours and perhaps take a walk or go shopping. Once the switch is complete, you will be prompted to reboot your CentOS system as shown.

CentOS to Oracle Linux Migration Completes
CentOS to Oracle Linux Migration Completes

Simply run the command:

$ sudo reboot

During the reboot, the Oracle Linux log will be splashed on the screen.

Oracle Linux Reboot
Oracle Linux Reboot

Shortly thereafter, the Grub menu will be displayed. The Oracle Linux Server entry will be first on the list, so hit ENTER on the keyboard to boot into Oracle Linux.

Oracle Linux Boot Menu
Oracle Linux Boot Menu

Once you are logged in, once again, verify the OS version as follows.

$ cat /etc/os-release 
Check Oracle Linux Version
Check Oracle Linux Version

And that’s it. We hope you found this guide useful.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

James Kiarie
This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.