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.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

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