oracle/centos2ol automation script | https://github.com/oracle/centos2ol

It’s a script plus documentation published by Oracle Corporation to allow switching a system running CentOS Linux (or in some cases Rocky Linux) over to Oracle Linux.


The purpose:
if we have a CentOS (or Rocky) system and we want to migrate it in place (i.e., without reinstalling) to Oracle Linux, this script aims to make that easier.

It handles things like replacing CentOS-specific packages, switching repositories, adjusting kernels, etc.

What versions are supported?

From the README:
CentOS Linux versions 6, 7, 8
Rocky Linux versions 8, 9 (but Rocky support is experimental)
Architectures: x86_64 and aarch64 (for both) — but again, aarch64 is marked as experimental for some of the above.


HOWTO (From the docs)

Preparation

Before running the script, we need to do some preparation work first.

Make a full backup of the system. Because the script is not guaranteed to work in all configurations.

Remove any non-standard kernels. For example, if we have kernels installed that are not from the official base or updates repo — we should remove them.

Disable any automatic update services (like yum-cron, dnf-automatic) because the switching process may conflict with ongoing updates.

Ensure enough free space (the docs say ~5 GB free in /var/cache) so that the switching process can fetch packages and do replacements.

Disable or remove non-CentOS repositories — to avoid conflicts when the script replaces repos/packages.


Running the switch script

Download the centos2ol.sh script (via curl or git clone from the GitHub repo).

Run it:
sudo bash centos2ol.sh

There are options:
-r: Reinstall all CentOS RPMs with Oracle Linux equivalents. This is optional and more for cleaning up completely.
-k: Do not install the UEK kernel (Oracle’s “Unbreakable Enterprise Kernel”) and disable UEK repositories — if you prefer keeping a more Red Hat compatible kernel rather than the UEK.
V: Verify RPM information before/after switching (writes logs) so you can audit what changed.


After the switch

Reboot the system. The switch will update repos, packages, kernels, bootloader entries. After reboot, the system should be running Oracle Linux.

Verify by checking /etc/os-release, /etc/oracle-release, and confirm we are on Oracle Linux.

Check that the kernel we want is in use — e.g., if we allowed UEK or kept the standard kernel. Some apps/hardware might depend on a specific kernel type (RHCK vs UEK).


Important

The script is useful but not a magic fix. See docs for full details.

The system needs network access to both CentOS and Oracle Linux yum repositories (direct or via proxy). If repos are stale, unreachable, switching may fail.

Instances registered with third-party management tools (like Spacewalk, Foreman, Uyuni) are not supported.

If we have many packages installed from non-standard or third-party repos, there’s no guarantee all will be compatible after the switch. Some software may assume /etc/centos-release, or specific vendor kernel modules may break.

If we have custom kernels or hardware drivers that depend on the CentOS kernel, switching kernels could cause boot / driver issues (especially if SecureBoot is used).

The support for Rocky Linux is experimental, as is support for aarch64 in certain cases. So if we are migrating from Rocky or on ARM64, proceed with caution.

The script only enables the base repositories needed for switching. If we later need extra modules/appstreams or third-party repos, we might need to re-enable them manually.


Why is this script useful?

If we are running CentOS (especially old versions) and want to continue receiving updates—or move to a compatible RHEL-clone without doing a full reinstall.

For example, after CentOS 8 reached end-of-life (EOL) and users needed to find alternative stable distributions compatible with RHEL — one option is Oracle Linux. The blog post by Oracle describes this scenario.

If we want “in-place” migration (keeping our settings, software, etc) rather than doing fresh OS install and reconfigure.


Suppose we have a CentOS 8 server.
Here’s how we would proceed at a high level:

Backup everything

Update our system so it’s at the latest CentOS version we have.

Check for non-standard kernels: e.g. run rpm -qa kernel*, use grubby --info=ALL. Remove kernels not from base/updates repo.

Disable automatic updates (yum-cron, dnf-automatic, etc).

Disable/clean up non-CentOS repos (so the script won’t run into conflicts).

Ensure we have ~5 GB free in /var/cache (so yum/dnf can download and install needed packages).

Download the script, e.g. curl -O https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh.

Run the script, e.g. sudo bash centos2ol.sh. (Add options if we want e.g. -k or -V, etc.)

Wait for it to complete, read the output.

Reboot the system.

After reboot, verify:
cat /etc/os-release, cat /etc/oracle-release → should show Oracle Linux.
uname -r → check kernel version and vendor.
Check enabled repositories: should be Oracle Linux ones.
Check installed packages: no or minimal remnants of CentOS vendor packages.
If everything is good, re-enable any pending third-party repos we need and test our applications.


Click here to open https://github.com/oracle/centos2ol

RISC V ROMA Laptop II


Enjoy #linux


Well, that was exciting. See you in the next one!