For many years, CentOS Linux was everywhere and beloved by Linux system administrators. Now, it’s time for a change and the reason is on 8th Dec 2020 (Read here), Red Hat suddenly announced that it’s cutting the official CentOS 8 support window from ten years – to just two years, which ended on 31st Dec 2021.

Still it has been widely used by small businesses and developers in server environments as it provides the security, stability and reliability that RHEL offers absolutely free of cost.

What is a CentOS stream?

CentOS stream seats between Fedora and RHEL. In other words, It acts as a gateway between Fedora and RHEL. RHEL will continue to release new versions of CentOS through CentOS Stream, but it is a rolling release: updates can come at any time so CentOS Stream will certainly not be recommended for production environments.

Centos-Stream
CentOS Stream

Options for securing CentOS

  • Switching, and switching right now, is the best way to secure CentOS 8. However, switching is only possible where the alternative distribution is also 1:1 binary compatible with RHEL.
  • Less feasible for most organizations is switching to a non-binary compatible Linux alternative – Ubuntu, or Debian perhaps. In some use cases that could be relatively easy, but most CentOS users would need to plan such a migration carefully. Please see more CentOS alternatives.

CentOS 7 will be supported until June 30, 2024. But if you want the most up-to-date RHEL clone in future then you’ll soon be out of luck.

CentOS EOL

ReleaseRelease DateEnd of life
CentOS Linux 7July 7, 2014June 30, 2024
CentOS Linux 8September 24, 2019December 31, 2021
Oracle Linux 8July 19, 2019July 01, 2029
CentOS lifecycle

Time to switch to Oracle Linux

Currently most of the cloud providers support centos 7 and centos stream officially but no official support available for Oracle Linux. If you are planning for the most up-to-date RHEL clone for your server then a recommended alternative is Oracle Linux which is 100% compatible with RHEL. This means the applications and features remain the same for Oracle Linux.

In this guide, we walk you through the migration of CentOS 7 to Oracle Linux 8.

Caution:

The switch from CentOS 7 to Oracle Linux 8 went smoothly in our case, However, we cannot guarantee with certainty that the same will be replicated in your case.

Prerequisites:

  • sudo privileges.
  • At least 5GB of free space in /var/cache.
  • Take complete backup of all your files.

Steps to migrate from Centos 7 to Oracle Linux 8

Check current CentOS version which is CentOS 7.

# cat /etc/centos-release

Check current Kernel version.
Note: Please make sure Kernel is not updated one like kernel-ml or kernel-lt

# uname -r

If Kernel version is kernel-ml or kernel-lt then change to default Kernel version.

# grub2-set-default 1
# grub2-mkconfig -o /boot/grub2/grub.cfg
# reboot

Then Install the EPEL Repository and yum-utils Tools.

# yum install epel-release.noarch -y
# yum makecache fast
# yum install yum-utils -y

Install rpmconf to resolve RPM packages

# yum install rpmconf -y
# rpmconf -a

Now clean-up of all the packages we don’t require

# package-cleanup --leaves
# package-cleanup --orphans

Install dnf package manager and Update CentOS 7 to latest version

# yum install dnf -y
# dnf makecache
# dnf upgrade -y

Upgrade CentOS 7 to CentOS 8 first

# dnf install http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/{centos-linux-repos-8-3.el8.noarch.rpm,centos-linux-release-8.5-1.2111.el8.noarch.rpm,centos-gpg-keys-8-3.el8.noarch.rpm} -y

Again upgrade EPEL Repository to latest one

# dnf upgrade epel-release -y OR
# dnf upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y

Now take backup of old centos repo

# cd /etc/yum.repos.d
# mkdir backups
# mv CentOS-* backups

Create CentOS 8 BaseOS  and AppStream repo
Note: CentOS 8 is dead and all the repos have been moved to vault.centos.org.

Add CentOS 8 BaseOS repo
# tee CentOS-Linux-BaseOS.repo<<EOM
[baseos]
name=CentOS Linux \$releasever - BaseOS
baseurl=http://vault.centos.org/8.5.2111/BaseOS/\$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOM

Add CentOS 8 AppStream repo
# tee CentOS-Linux-AppStream.repo<<EOM
[appstream]
name=CentOS Linux \$releasever - AppStream
baseurl=http://vault.centos.org/8.5.2111/AppStream/\$basearch/os/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
EOM

Remove the old CentOS 7 Kernel which is not in use

# rpm -e `rpm -q kernel` --nodeps

Now remove all the conflicting packages

# rpm -e --nodeps sysvinit-tools
# dnf remove dracut-network python36-rpmconf-*.el7.1.noarch

Remove YUM package manager which is used in CentOS 7

# dnf remove yum yum-metadata-parser -y
# rm -Rf /etc/yum

Run CentOS 8 system upgrade

# dnf --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync -y
# dnf check

Install new kernel for CentOS 8

# dnf install kernel-core -y

Install CentOS 8 minimal packages

# dnf groupupdate "Core" "Minimal Install" -y

Reboot the server and check the OS which is upgraded to CentOS 8.
Note: After reboot the server will take time to come online.

# reboot
# cat /etc/centos-release

Install yum and yum-utils tools again

# dnf makecache
# dnf install yum-utils.noarch -y

Now download the centos2ol.sh script from GitHub for migrate to Oracle Linux 8

# curl -O https://raw.githubusercontent.com/oracle/centos2ol/main/centos2ol.sh

Then run the centos2ol.sh script, It will take a while to complete the script.

# bash centos2ol.sh

If faced any problem related to sync with Oracle Linux repositories then run this.

# yum distro-sync

Last reboot the server and Verify the upgrade.
Note: After reboot the server will take time to come online.

# reboot
# cat /etc/oracle-release

Migration video of Centos 7 to Oracle Linux 8

Congratulations! You have migrated your server from CentOS 7 to Oracle Linux 8!
We hope you found this 2 minutes stuff useful and thank you for visiting our website.
Cheers!!!