Switch to Oracle Linux

Switching to Oracle Linux is as simple as running the centos2ol.sh script. This script will automatically switch a CentOS instance to Oracle Linux by removing any CentOS-specific packages or replacing them with the Oracle Linux equivalent.

This article will show you how to prepare your system, obtain and run the script, and then test it to ensure the migration is successful.

Prepare Your System

Before downloading and running the centos2ol.sh script, you need to ensure your system is ready to run it. This article will walk you through these basic preparation steps.

Back Up Everything

This script is not designed to handle all possible configurations. Please ensure you have a complete backup of the system before you start this process in the event the script is unable to convert your system successfully.

Remove All Non-Standard Kernels

Oracle strongly recommends that you remove all non-standard kernels; that is, any installed kernel not provided by either the base or updates repo. This includes the centosplus kernels.

Because of the GRUB2 BootHole vulnerability, our SecureBoot shim can only boot kernels signed by Oracle and we can only replace the default CentOS kernels. While this may not have an impact if SecureBoot is currently disabled, enabling it at a later date could render the system unbootable.

Before running the script:
  • Ensure your CentOS yum or dnf configuration is working; that is, there are no stale repositories.
  • Disable all non-CentOS repositories. You can re-enable the repositories after the switch.
  • Ensure you have at least 5GB of free space in /var/cache.
  • Disable all automatic updates; for example, via yum-cron.

Obtain the Script

With your system prepared, can now obtain the centos2ol.sh script from Github.

Open the Github Repository link (under Download Code) in the left navigation bar and clone the respository. If you don't have Git installed, you can use curl to download it:
  1. Login to your CentOS Linux 6, 7 or 8 instance as a user with sudo privileges.
  2. Enter the command:
    $ curl -O https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh
    The system responds:
    
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 10747 100 10747 0 0 31241 0 --:--:-- --:--:-- --:--:-- 31241

Run the Script

To complete the switch from CentOS to Oracle Linux, now run the script:

$ sudo bash centos2ol.sh
You can add functionality to the script with any of these usage options:

After you've run the script, test it on a Dev or test environment before running it on your production environment.

Enable Debugging

You can enable debugging by using this command:

sudo bash -x centos2ol.sh 

This will switch your CentOS instance to Oracle Linux in debug mode. In debug mode, Oracle Linux will print a trace of commands and their arguments or associated word lists after they are expanded but before they are executed.