As you might be aware, CentOS 8 is end of life since the 31st of December 2021. If you are still using and running CentOS 8, you might want to migrate to some alternative distributions in order to keep a Red Hat compatibility.
Those alternative distributions might be chosen between :
- Rocky Linux
- AlmaLinux
- Red Hat Enterprise Linux
- Oracle Linux
We are already having a few blogs describing how to migrate to Rocky Linux, AlmaLinux and Red Hat Enterprise Linux :
In this blog we will see how to migrate from CentOS 8 to Oracle Linux 8.
centos2ol.sh Oracle Script
Oracle provides a script to be able to switch from CentOS Linux 6, 7 or 8 to its equivalent version of Oracle Linux. The script as well as requirements, limitations, know issues and explanations can be found on the oracle GitHub website.
Please read carefully the limitations part. Access to both CentOS and Oracle Linux yum repositories is mandatory.
Before starting the migration using the script it is very important to ensure having a complete working backup of the system.
Migration demo
I have setup a linux environment running CentOS 8.
[root@centosmigr ~]# cat /etc/centos-release CentOS Linux release 8.4.2105
We need to download the centos2ol.sh script and move it to the CentOS Linux server to be migrated. This can be done using curl command.
[root@centosmigr ~]# curl -O https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 22928 100 22928 0 0 120k 0 --:--:-- --:--:-- --:--:-- 121k [root@centosmigr ~]# ls -l centos*.sh -rw-r--r--. 1 root root 22928 Jun 8 08:13 centos2ol.sh
Let’s first check the current kernel and kernel executable files :
[root@centosmigr ~]# uname -a Linux centosmigr 4.18.0-305.3.1.el8.x86_64 #1 SMP Tue Jun 1 16:14:33 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux [root@centosmigr ~]# ls -l /boot total 153964 -rw-r--r--. 1 root root 192095 Jun 1 2021 config-4.18.0-305.3.1.el8.x86_64 drwxr-xr-x. 3 root root 17 Jun 2 2021 efi drwxr-xr-x. 2 root root 39 Jun 2 2021 grub drwx------. 4 root root 83 Jun 8 08:14 grub2 -rw-------. 1 root root 64383726 Jun 2 2021 initramfs-0-rescue-40ec35b37a254049be3d85f9173b39a1.img -rw-------. 1 root root 51128711 Jun 2 2021 initramfs-4.18.0-305.3.1.el8.x86_64.img -rw-------. 1 root root 17727685 Jun 3 14:44 initramfs-4.18.0-305.3.1.el8.x86_64kdump.img drwxr-xr-x. 3 root root 21 Jun 2 2021 loader -rw-------. 1 root root 4164308 Jun 1 2021 System.map-4.18.0-305.3.1.el8.x86_64 -rwxr-xr-x. 1 root root 10026120 Jun 2 2021 vmlinuz-0-rescue-40ec35b37a254049be3d85f9173b39a1 -rwxr-xr-x. 1 root root 10026120 Jun 1 2021 vmlinuz-4.18.0-305.3.1.el8.x86_64
And my current centos linux package :
[root@centosmigr ~]# rpm -qa | grep -i centos centos-linux-repos-8-2.el8.noarch centos-logos-85.5-1.el8.x86_64 centos-linux-release-8.4-1.2105.el8.noarch centos-gpg-keys-8-2.el8.noarch
We can run the conversion script from Oracle with centos user knowing it has the sudo priviledge. The option of the script are the following one :
[centos@centosmigr ~]$ sudo bash /root/centos2ol.sh -h Usage: centos2ol.sh [OPTIONS] OPTIONS -h Display this help and exit -k Do not install the UEK kernel and disable UEK repos -r Reinstall all CentOS RPMs with Oracle Linux RPMs Note: This is not necessary for support -V Verify RPM information before and after the switch
Note that in can we would prefer to migrate to the Red Hat compatible Kernel and not to UEK, we can use the option -k. This option will not install the UEK kernel and also disable UEK repository.
We will run the script with the -V option.
[centos@centosmigr ~]$ sudo bash /root/centos2ol.sh -V
After a first few checks, the script will backup and remove CentOS repository files, followed by a download and an installation of Oracle Linux repositories.
Backing up and removing old repository files... Removing CentOS-specific yum configuration from /etc/yum.conf
We can easily confirm this by checking the yum repository files.
[centos@centosmigr tmp]$ ls -l /etc/yum.repos.d/ total 60 -rw-r--r--. 1 root root 891 Jun 8 08:34 CentOS-Linux-AppStream.repo.disabled -rw-r--r--. 1 root root 876 Jun 8 08:34 CentOS-Linux-BaseOS.repo.disabled -rw-r--r--. 1 root root 1302 Jun 8 08:34 CentOS-Linux-ContinuousRelease.repo.disabled -rw-r--r--. 1 root root 490 Jun 8 08:34 CentOS-Linux-Debuginfo.repo.disabled -rw-r--r--. 1 root root 904 Jun 8 08:34 CentOS-Linux-Devel.repo.disabled -rw-r--r--. 1 root root 876 Jun 8 08:34 CentOS-Linux-Extras.repo.disabled -rw-r--r--. 1 root root 891 Jun 8 08:34 CentOS-Linux-FastTrack.repo.disabled -rw-r--r--. 1 root root 912 Jun 8 08:34 CentOS-Linux-HighAvailability.repo.disabled -rw-r--r--. 1 root root 865 Jun 8 08:34 CentOS-Linux-Media.repo.disabled -rw-r--r--. 1 root root 878 Jun 8 08:34 CentOS-Linux-Plus.repo.disabled -rw-r--r--. 1 root root 896 Jun 8 08:34 CentOS-Linux-PowerTools.repo.disabled -rw-r--r--. 1 root root 1070 Jun 8 08:34 CentOS-Linux-Sources.repo.disabled -rw-r--r--. 1 root root 2961 Jun 8 08:35 oracle-linux-ol8.repo -rw-r--r--. 1 root root 470 May 11 22:21 uek-ol8.repo -rw-r--r--. 1 root root 243 May 11 22:21 virt-ol8.repo
The CentOS repositories have been disabled and the new Oracle Linux repositories have been installed.
The script will then download latest Oracle Linux release package.
Downloading Oracle Linux release package... Oracle Linux 8 BaseOS Latest (x86_64) 146 MB/s | 46 MB 00:00 Oracle Linux 8 Application Stream (x86_64) 131 MB/s | 36 MB 00:00 Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64) 152 MB/s | 48 MB 00:00 Last metadata expiration check: 0:00:08 ago on Wed 08 Jun 2022 08:34:52 AM UTC. (1/3): oraclelinux-release-el8-1.0-23.el8.x86_64.rpm 567 kB/s | 21 kB 00:00 (2/3): redhat-release-8.6-0.1.0.1.el8.x86_64.rpm 497 kB/s | 19 kB 00:00 (3/3): oraclelinux-release-8.6-1.0.5.el8.x86_64.rpm 1.6 MB/s | 77 kB 00:00
In order to finally start switching old CentOS release package with Oracle Linux.
Switching old release package with Oracle Linux...
The base packages for CentOS will be removed and the one for Oracle Linux will be installed.
Enabling ol8_appstream which replaces appstream Enabling ol8_baseos_latest which replaces baseos Installing base packages for Oracle Linux... Oracle Linux 8 BaseOS Latest (x86_64) 202 kB/s | 3.6 kB 00:00 Oracle Linux 8 Application Stream (x86_64) 204 kB/s | 3.9 kB 00:00 > Package basesystem-11-5.el8.noarch is already installed. Package initscripts-10.00.15-1.el8.x86_64 is already installed. Package grub2-pc-1:2.02-99.el8.x86_64 is already installed. Package grubby-8.40-41.el8.x86_64 is already installed. > ============================================================================================================================================================================================================================================================== Package Architecture Version Repository Size ============================================================================================================================================================================================================================================================== Installing: kernel-uek x86_64 5.4.17-2136.307.3.6.el8uek ol8_UEKR6 109 M oracle-logos x86_64 84.5-1.0.1.el8 ol8_baseos_latest 1.4 M plymouth x86_64 0.9.4-11.20200615git1e36e30.0.1.el8 ol8_appstream 127 k Upgrading: grub2-common noarch 1:2.02-123.0.3.el8 ol8_baseos_latest 895 k grub2-pc x86_64 1:2.02-123.0.3.el8 ol8_baseos_latest 45 k grub2-pc-modules noarch 1:2.02-123.0.3.el8 ol8_baseos_latest 924 k grub2-tools x86_64 1:2.02-123.0.3.el8 ol8_baseos_latest 2.0 M grub2-tools-extra x86_64 1:2.02-123.0.3.el8 ol8_baseos_latest 1.1 M grub2-tools-minimal x86_64 1:2.02-123.0.3.el8 ol8_baseos_latest 213 k grubby x86_64 8.40-42.0.1.el8 ol8_baseos_latest 50 k tuned noarch 2.18.0-2.0.1.el8 ol8_baseos_latest 318 k Installing dependencies: grub2-tools-efi x86_64 1:2.02-123.0.3.el8 ol8_baseos_latest 478 k linux-firmware noarch 999:20220304-999.13.gitf011ccb4.el8 ol8_baseos_latest 216 M linux-firmware-core noarch 999:20220304-999.13.gitf011ccb4.el8 ol8_baseos_latest 509 k plymouth-core-libs x86_64 0.9.4-11.20200615git1e36e30.0.1.el8 ol8_appstream 122 k plymouth-scripts x86_64 0.9.4-11.20200615git1e36e30.0.1.el8 ol8_appstream 44 k Removing: centos-gpg-keys noarch 1:8-2.el8 @anaconda 3.3 k centos-linux-release noarch 8.4-1.2105.el8 @anaconda 25 k centos-logos x86_64 85.5-1.el8 @anaconda 698 k python3-syspurpose x86_64 1.28.13-2.el8 @anaconda 138 k Transaction Summary ============================================================================================================================================================================================================================================================== Install 8 Packages Upgrade 8 Packages Remove 4 Packages Total download size: 333 M Downloading Packages: (1/16): linux-firmware-core-20220304-999.13.gitf011ccb4.el8.noarch.rpm 13 MB/s | 509 kB 00:00 (2/16): grub2-tools-efi-2.02-123.0.3.el8.x86_64.rpm 11 MB/s | 478 kB 00:00 (3/16): plymouth-0.9.4-11.20200615git1e36e30.0.1.el8.x86_64.rpm 21 MB/s | 127 kB 00:00 ... ... ... Running transaction Preparing : 1/1 Running scriptlet: grub2-common-1:2.02-123.0.3.el8.noarch 1/1 Upgrading : grub2-common-1:2.02-123.0.3.el8.noarch 1/28 Upgrading : grub2-tools-minimal-1:2.02-123.0.3.el8.x86_64 2/28 ... ... ... Installing : plymouth-scripts-0.9.4-11.20200615git1e36e30.0.1.el8.x86_64 7/28 Installing : plymouth-0.9.4-11.20200615git1e36e30.0.1.el8.x86_64 8/28 Installing : linux-firmware-core-999:20220304-999.13.gitf011ccb4.el8.noarch 9/28 ... ... ... Verifying : centos-logos-85.5-1.el8.x86_64 27/28 Verifying : python3-syspurpose-1.28.13-2.el8.x86_64 28/28 Upgraded: grub2-common-1:2.02-123.0.3.el8.noarch grub2-pc-1:2.02-123.0.3.el8.x86_64 grub2-pc-modules-1:2.02-123.0.3.el8.noarch grub2-tools-1:2.02-123.0.3.el8.x86_64 grub2-tools-extra-1:2.02-123.0.3.el8.x86_64 grub2-tools-minimal-1:2.02-123.0.3.el8.x86_64 grubby-8.40-42.0.1.el8.x86_64 tuned-2.18.0-2.0.1.el8.noarch Installed: grub2-tools-efi-1:2.02-123.0.3.el8.x86_64 kernel-uek-5.4.17-2136.307.3.6.el8uek.x86_64 linux-firmware-999:20220304-999.13.gitf011ccb4.el8.noarch linux-firmware-core-999:20220304-999.13.gitf011ccb4.el8.noarch oracle-logos-84.5-1.0.1.el8.x86_64 plymouth-0.9.4-11.20200615git1e36e30.0.1.el8.x86_64 plymouth-core-libs-0.9.4-11.20200615git1e36e30.0.1.el8.x86_64 plymouth-scripts-0.9.4-11.20200615git1e36e30.0.1.el8.x86_64 Removed: centos-gpg-keys-1:8-2.el8.noarch centos-linux-release-8.4-1.2105.el8.noarch centos-logos-85.5-1.el8.x86_64 python3-syspurpose-1.28.13-2.el8.x86_64 Complete!
We can then see a nice message that the switch was successful and that the system will now sync with the oracle Linux repositories.
Switch successful. Syncing with Oracle Linux repositories. 204 kB/s | 3.9 kB 00:00
Syncing means upgrading all packages to Oracle Linux ol8 release and installing the kernel.
Dependencies resolved. ============================================================================================================================================================================================================================================================== Package Architecture Version Repository Size ============================================================================================================================================================================================================================================================== Installing: kernel x86_64 4.18.0-372.9.1.el8 ol8_baseos_latest 8.0 M kernel-core x86_64 4.18.0-372.9.1.el8 ol8_baseos_latest 39 M kernel-modules x86_64 4.18.0-372.9.1.el8 ol8_baseos_latest 32 M Upgrading: NetworkManager x86_64 1:1.36.0-4.0.1.el8 ol8_baseos_latest 2.3 M NetworkManager-libnm x86_64 1:1.36.0-4.0.1.el8 ol8_baseos_latest 1.8 M NetworkManager-team x86_64 1:1.36.0-4.0.1.el8 ol8_baseos_latest 153 k NetworkManager-tui x86_64 1:1.36.0-4.0.1.el8 ol8_baseos_latest 345 k 204 kB/s | 3.9 kB 00:00 ... ... ... Transaction Summary ============================================================================================================================================================================================================================================================== Install 6 Packages Upgrade 238 Packages Total download size: 318 M Downloading Packages: (1/414): basesystem-11-5.el8.noarch.rpm 342 kB/s | 10 kB 00:00 (2/414): bzip2-1.0.6-26.el8.x86_64.rpm 13 MB/s | 60 kB 00:00 (3/414): bzip2-libs-1.0.6-26.el8.x86_64.rpm 18 MB/s | 48 kB 00:00 (4/414): acl-2.2.53-1.el8.x86_64.rpm 1.9 MB/s | 81 kB 00:00 (5/414): brotli-1.0.6-3.el8.x86_64.rpm 7.3 MB/s | 323 kB 00:00 (6/414): cracklib-2.9.6-15.el8.x86_64.rpm 17 MB/s | 93 kB 00:00 ... ... ...
This intent to upgrade, reinstall, install or cleanup packages as well as running packages’ scriptlets.
Upgrading : filesystem-3.8-6.el8.x86_64 3/822 Upgrading : tzdata-2022a-1.el8.noarch 4/822 Reinstalling : fontpackages-filesystem-1.44-22.el8.noarch 5/822 ... Running scriptlet: libproxy-0.4.15-5.2.el8.x86_64 113/822 ... Installing : libbpf-0.4.0-3.el8.x86_64 117/822 ... Cleanup : glib2-2.56.4-9.el8.x86_64 695/822
As any upgrade, there will be a verification step.
Verifying : acl-2.2.53-1.el8.x86_64 1/822 Verifying : acl-2.2.53-1.el8.x86_64 2/822 Verifying : basesystem-11-5.el8.noarch 3/822
At the end of the package installation we can review the packages that were upgraded, installed or reinstalled.
Upgraded: NetworkManager-1:1.36.0-4.0.1.el8.x86_64 NetworkManager-libnm-1:1.36.0-4.0.1.el8.x86_64 NetworkManager-team-1:1.36.0-4.0.1.el8.x86_64 NetworkManager-tui-1:1.36.0-4.0.1.el8.x86_64 PackageKit-1.1.12-6.0.1.el8.x86_64 PackageKit-glib-1.1.12-6.0.1.el8.x86_64 audit-3.0.7-2.el8.2.x86_64 audit-libs-3.0.7-2.el8.2.x86_64 ... virt-what-1.18-13.el8.x86_64 which-2.21-17.el8.x86_64 xfsprogs-5.4.0-1.0.1.el8.x86_64 yum-4.7.0-8.0.1.el8.noarch yum-utils-4.0.21-11.0.1.el8.noarch zlib-1.2.11-18.el8_5.x86_64 Installed: NetworkManager-initscripts-updown-1:1.36.0-4.0.1.el8.noarch kernel-4.18.0-372.9.1.el8.x86_64 kernel-core-4.18.0-372.9.1.el8.x86_64 kernel-modules-4.18.0-372.9.1.el8.x86_64 libbpf-0.4.0-3.el8.x86_64 python3-netifaces-0.10.6-4.el8.x86_64 Reinstalled: abattis-cantarell-fonts-0.0.25-6.el8.noarch acl-2.2.53-1.el8.x86_64 basesystem-11-5.el8.noarch brotli-1.0.6-3.el8.x86_64 bzip2-1.0.6-26.el8.x86_64 ... xkeyboard-config-2.28-1.el8.noarch xz-5.2.4-3.el8.x86_64 xz-libs-5.2.4-3.el8.x86_64 Complete!
At the end of the script execution we can see the output that the sync is successful.
Sync successful.
The system will update the boot loader, generate the new grub configuration file and switch the default boot kernel to the Oracle Linux kernel (UEK).
Updating the GRUB2 bootloader. Generating grub configuration file ... done Switching default boot kernel to the UEK. Removing yum cache
The option -V has created four log files for listing and verifying the packages before and after the migration.
Creating a list of RPMs installed after the switch Verifying RPMs installed after the switch against RPM database Review the output of following files: /var/tmp/centosmigr-rpms-list-before.log /var/tmp/centosmigr-rpms-verified-before.log /var/tmp/centosmigr-rpms-list-after.log /var/tmp/centosmigr-rpms-verified-after.log
And finally the script will end with an output confirming the switch has been successful completed. A reboot is now more than recommended.
Switch complete. Oracle recommends rebooting this system.
Checking system after switching to Oracle Linux
Let’s check the new Linux version and confirm we are running Oracle Linux.
[centos@centosmigr ~]$ ls -l /etc/*release* -rw-r--r--. 1 root root 32 May 13 01:14 /etc/oracle-release -rw-r--r--. 1 root root 479 May 13 01:14 /etc/os-release -rw-r--r--. 1 root root 45 May 13 01:14 /etc/redhat-release lrwxrwxrwx. 1 root root 14 May 13 01:14 /etc/system-release -> oracle-release -rw-r--r--. 1 root root 31 May 13 01:14 /etc/system-release-cpe [centos@centosmigr ~]$ cat /etc/oracle-release Oracle Linux Server release 8.6 [centos@centosmigr ~]$
Let’s check the running kernel.
[centos@centosmigr ~]$ uname -a Linux centosmigr 4.18.0-305.3.1.el8.x86_64 #1 SMP Tue Jun 1 16:14:33 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
This is the old one, we need to reboot the server first.
[centos@centosmigr ~]$ sudo systemctl reboot Connection to 172.21.9.153 closed by remote host. Connection to 172.21.9.153 closed.
After reboot, the system will be started on the new Oracle Linux kernel.
[centos@centosmigr ~]$ uptime 11:23:08 up 1 min, 1 user, load average: 1.64, 0.53, 0.19 [centos@centosmigr ~]$ uname -a Linux centosmigr 5.4.17-2136.307.3.6.el8uek.x86_64 #2 SMP Wed Jun 1 13:54:41 PDT 2022 x86_64 x86_64 x86_64 GNU/Linux
Let’s check the boot loader folder.
[centos@centosmigr ~]$ ls -ltrh /boot total 516M -rw-------. 1 root root 4.0M Jun 1 2021 System.map-4.18.0-305.3.1.el8.x86_64 -rw-r--r--. 1 root root 188K Jun 1 2021 config-4.18.0-305.3.1.el8.x86_64 -rwxr-xr-x. 1 root root 9.6M Jun 1 2021 vmlinuz-4.18.0-305.3.1.el8.x86_64 drwxr-xr-x. 3 root root 17 Jun 2 2021 efi drwxr-xr-x. 3 root root 21 Jun 2 2021 loader -rwxr-xr-x. 1 root root 9.6M Jun 2 2021 vmlinuz-0-rescue-40ec35b37a254049be3d85f9173b39a1 -rw-------. 1 root root 62M Jun 2 2021 initramfs-0-rescue-40ec35b37a254049be3d85f9173b39a1.img drwxr-xr-x. 2 root root 39 Jun 2 2021 grub -rw-------. 1 root root 4.2M May 12 03:21 System.map-4.18.0-372.9.1.el8.x86_64 -rw-r--r--. 1 root root 192K May 12 03:21 config-4.18.0-372.9.1.el8.x86_64 -rwxr-xr-x. 1 root root 10M May 12 03:21 vmlinuz-4.18.0-372.9.1.el8.x86_64 -rw-------. 1 root root 4.3M Jun 1 21:00 System.map-5.4.17-2136.307.3.6.el8uek.x86_64 -rw-r--r--. 1 root root 213K Jun 1 21:00 config-5.4.17-2136.307.3.6.el8uek.x86_64 -rwxr-xr-x. 1 root root 10M Jun 1 21:00 vmlinuz-5.4.17-2136.307.3.6.el8uek.x86_64 lrwxrwxrwx. 1 root root 57 Jun 8 08:35 symvers-5.4.17-2136.307.3.6.el8uek.x86_64.gz -> /lib/modules/5.4.17-2136.307.3.6.el8uek.x86_64/symvers.gz -rw-------. 1 root root 86M Jun 8 08:36 initramfs-5.4.17-2136.307.3.6.el8uek.x86_64.img -rwxr-xr-x. 1 root root 10M Jun 8 08:36 vmlinuz-0-rescue-ec2f03aecd97c5f99095ff2f3f63a155 -rw-------. 1 root root 86M Jun 8 08:37 initramfs-0-rescue-ec2f03aecd97c5f99095ff2f3f63a155.img -rw-------. 1 root root 27M Jun 8 08:42 initramfs-4.18.0-305.3.1.el8.x86_64kdump.img lrwxrwxrwx. 1 root root 49 Jun 8 08:42 symvers-4.18.0-372.9.1.el8.x86_64.gz -> /lib/modules/4.18.0-372.9.1.el8.x86_64/symvers.gz -rw-------. 1 root root 87M Jun 8 08:44 initramfs-4.18.0-372.9.1.el8.x86_64.img -rw-------. 1 root root 82M Jun 8 08:45 initramfs-4.18.0-305.3.1.el8.x86_64.img -rw-------. 1 root root 27M Jun 8 11:22 initramfs-5.4.17-2136.307.3.6.el8uek.x86_64kdump.img drwx------. 4 root root 83 Jun 8 11:25 grub2
And we can confirm that there is no CentOS base package installed on the system any more.
[centos@centosmigr ~]$ rpm -qa | grep -i centos [centos@centosmigr ~]$
Conclusion
Switching CentOS 8 to Oracle Linux 8 was quite fast and simple. Of course, it might be more complicated on a production system having several other third party packages and softwares installed. Those package might need to certainly be reinstalled. The packages that install 3rd party kernel modules will for sure not work any more after switching, and would need to be reinstalled. Also the script only enables base repositories needed to switch to Oracle Linux. Before upgrading some packages, some additional repositories might need to be enabled first.