Getting ready
Before you start, you will need a system running Scientific Linux 7.x and 8.x, Rocky 8.x, and CentOS 7.x and 8.X. If your CentOS system is CentOS Stream, the script will not work. There are a few other things to think about before running the Oracle script, as follows:
- Make sure you have a solid backup. Snapshots of the system work best in case things don’t go well.
- If Secure Boot is running, disable it with mokutil –sb-state. You can check the status by running the bootctl status command.
- Make sure you have console access, just in case you need to troubleshoot issues.
- Disable any network mounts, such as NFS mounts, Samba mounts, and GlusterFS mounts. Disable them in your /etc/fstab file.
- If you are using yum-plugin-versionlock, clear any locks with the yum versionlock clear command.
- If you are running any KVM VMs, stop them all. You can do this with virsh shutdown $VM_NAME=. If you’re not sure whether you’re running any VMs, the virsh list –all command will list them all out for you.
- If you are using Spacewalk, Oracle Linux Manager, Unbreakable Linux Network, or any other centralized yum manager, make sure the yum command works. Unlike Leapp, you can run the script against a private repo.
- If you need an HTTP proxy to access your yum server, make sure it is added to your /etc/yum.conf file.
- If you are using any third-party yum repos, please validate that their packages will not conflict with what you are running. It’s best to disable these repos while doing the switch.
- Check for stale repos. If the repo isn’t working, disable it.
- Make sure you have at least 5 GB of free space in /var/cache.
- Disable all automatic yum updates.
How to do it…
Now that you have checked and prepared the system to be migrated from CentOS, the actual migration from CentOS 8.x is fairly straightforward. You’ll now need to follow these steps:
- The easy way to do the upgrade is to use wget to download the script from GitHub as a raw file: https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh.
- Next, you will need to perform the chmod +x operation the script with the following:
chmod +x centos2ol.sh
- Remember how CentOS 8 hit EOL really early? This also means that the CentOS yum repos for version 8 are gone. There is a workaround to this small problem, though. For now, you can use a copy located at vault.centos.org, but each of the repo files will need to be updated. That can be done with this command:
sed -i ‘s/mirrorlist/#mirrorlist/g’ /etc/yum.repos.d/CentOS-*
You can also use this one:
sed -i ‘s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g’ /etc/yum.repos.d/CentOS-* - Next, run the script using ./centos2ol.sh:

Figure 1.20 – CentOS to Oracle Linux process starting
This will run for about 5 minutes on a fast system with 1GB/s internet speeds. Other systems can take as long as 45 minutes. When the script is done, reboot. As with Leapp, you can check the upgrade by looking at /etc/oracle-release and checking the kernel version with uname -r:

Figure 1.21 – Migration from CentOS 8 completed
Once the reboot has finished and the server is up, /etc/oracle-release should correctly show Oracle Linux.
How it works…
The script will connect your system to new patch repositories, and then basically perform an extended patch process against the Oracle repos. Old RPMs will be replaced with RPMs from Oracle. The script can also upgrade you from the older Linux 4.x kernel to UEK, where you can benefit from the performance advantages of the newer Linux 5 kernel.