CentOS Linux will be replaced by CentOS Stream after end of December 2021. In another words CentOS will need to be migrated to CentOS Stream or other distro. CentOS Stream will not have tested/verified patches, updates etc. like current CentOS Linux. Please refer to https://www.redhat.com/en/blog/centos-stream-building-innovative-future-enterprise-linux for official announcement from Red Hat.
In this article I will cover how to migrate CentOS to Oracle Linux. There is a script available which performs this migration. It is available at https://github.com/oracle/centos2ol. Refer to https://linux.oracle.com/switch/centos/ for some basic FAQ around this migration. For CentOS 8 to Oracle Linux 8 migration, also refer to Oracle Support document Oracle Linux: How to Switch Centos 8 to Oracle Linux 8 (Doc ID 2698144.1) for more additional guidelines.
This is very straightforward process since the script takes care of end-to-end migration process. However I’ve seen at least once scenario where existing yum configuration on CentOS can cause issue during the migration. This configuration is “Distroverpkg” parameter in /etc/yum.conf file. If you notice following parameter set in yum.conf file then comment it before proceeding with migration.
Distroverpkg=centos-release
Let’s migrate CentOS 7 to Oracle Linux 7. First download the centos2ol.sh script.
[root@centos7 ~]# 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 19912 100 19912 0 0 24087 0 –:–:– –:–:– –:–:– 24077
[root@centos7 ~]# ll | grep centos2ol
total 28
-rw-r–r–. 1 root root 19912 Dec 19 10:43 centos2ol.sh
Run centos2ol.sh to perform migration.
[root@centos7 ~]# bash centos2ol.sh
Checking for required packages…
Checking your distribution…
Checking for yum lock…
Checking for required python packages…
Finding your repository directory…
Learning which repositories are enabled…
Repositories enabled before update include:
base
extras
updates
Downloading Oracle Linux yum repository file…
……………………
Complete!
Generating grub configuration file …
Found linux image: /boot/vmlinuz-5.4.17-2036.101.2.el7uek.x86_64
Found initrd image: /boot/initramfs-5.4.17-2036.101.2.el7uek.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.11.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.11.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-7b55f5f75a4942e1a4b325984511e8ac
Found initrd image: /boot/initramfs-0-rescue-7b55f5f75a4942e1a4b325984511e8ac.img
done
Removing yum cache
Switch complete. Oracle recommends rebooting this system.
Now reboot the server. It will take a few minutes to finish the remaining post-migration steps. Server will be started with Unbreakable Enterprise Kernel (UEK) as default kernel.
If you decide that you need to run Red Hat Compatible Kernel (RHCK), then make it default kernel before reboot.
[root@centos7 yum.repos.d]# sudo grubby –info=ALL | grep ^kernel
kernel=/boot/vmlinuz-5.4.17-2036.101.2.el7uek.x86_64
kernel=/boot/vmlinuz-3.10.0-1160.11.1.el7.x86_64
kernel=/boot/vmlinuz-3.10.0-1160.el7.x86_64
kernel=/boot/vmlinuz-0-rescue-7b55f5f75a4942e1a4b325984511e8ac
[root@centos7 yum.repos.d]# grubby –set-default /boot/vmlinuz-3.10.0-1160.11.1.el7.x86_64
[root@centos7 yum.repos.d]# sudo grubby –default-kernel
/boot/vmlinuz-3.10.0-1160.11.1.el7.x86_64
[root@centos7 ~]# reboot
[root@centos7 ~]# uname -a
Linux centos7.dj.local 3.10.0-1160.11.1.el7.x86_64 #1 SMP Tue Dec 15 11:58:45 PST 2020 x86_64 x86_64 x86_64 GNU/Linux