How to Migrate from CentOS 8 to Alma Linux (for VPS using CentOS with cPanel or Plesk )

After the CentOS EL repository was cut off from the mirrors many server admins got panicked.  Some of them switched to other OS and some migrated to alma linux and rockylinux. Not only big industries were affected by the EoL of CentOS 8 medium - small scale VPS  and Reseller hosting  companies which served their clients using application like cPanel and Plesk got affected too. 

How to Migrate from CentOS 8 to Alma Linux  (for VPS using CentOS with cPanel or Plesk  )

As CentOS8 reached its EoL(End of Life) in December 2021, all the repository mirrors were taken down after the date. In the announcement by CentOS team, CentOS Project will now only focus on CentOS stream.  You can find the complete announcement here.   CentOS Stream is a continuously releasing distro, which means that there will be no point release like 8.2, 8.3 ... and which gets bug fixes continuously. 

After the CentOS EL repository was cut off from the mirrors many server admins got panicked.  Some of them switched to other OS and some migrated to alma linux and rockylinux. Not only big industries were affected by the EoL of CentOS 8 medium - small scale VPS  and Reseller hosting  companies which served their clients using application like cPanel and Plesk got affected too. 

Alma Linux  is another rebuild of RHEL like centOS originally created by CloudLinux to provide community based, production grade enterprise Operating System which is binary comptible to Red Hat Enterprise Linux. First 

You can  migrate to AlmaLinux following these easy few steps: 

1.  updating at least to Cent OS 8.4  is recommended before you migrate to Alma Linux.  

sudo dnf update -y

2. Reboot the system after the update.

sudo reboot

If you did not get any updates from the previous app stream you can update your appsteam config and get update upto  CentOS 8.5 using these mirror links.

sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[baseos\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/BaseOS/$basearch/os' /etc/yum.repos.d/CentOS-Linux-BaseOS.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[appstream\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/AppStream/$basearch/os' /etc/yum.repos.d/CentOS-Linux-AppStream.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[cr\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/ContinuousRelease/$basearch/os' /etc/yum.repos.d/CentOS-Linux-ContinuousRelease.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[devel\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/Devel/$basearch/os' /etc/yum.repos.d/CentOS-Linux-Devel.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[extras\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/extras/$basearch/os' /etc/yum.repos.d/CentOS-Linux-Extras.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[fasttrack\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/fasttrack/$basearch/os' /etc/yum.repos.d/CentOS-Linux-FastTrack.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[ha\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/HighAvailability/$basearch/os' /etc/yum.repos.d/CentOS-Linux-HighAvailability.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[plus\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/centosplus/$basearch/os' /etc/yum.repos.d/CentOS-Linux-Plus.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[powertools\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/PowerTools/$basearch/os' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo

3. Please Perform a complete backup or system snapshot before you continue to start the migration.

4. Download almalinux deploy .sh linux script 

curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

5.  After the download git it an execution permission using

chmod +x  almalinux-deploy.sh

6. Now to migrate to alma run the script using

sudo bash almalinux-deploy.sh

7. Reboot after the successful migration 

sudo reboot

8. Now to check if you have been migrated to alma linix you can check the release file

# check release file
$ cat /etc/redhat-release
AlmaLinux release 8.5 (Arctic Sphynx)

# check that the system boots AlmaLinux kernel by default
$ sudo grubby --info DEFAULT | grep AlmaLinux
title="AlmaLinux (4.18.0-348.el8.x86_64) 8.5 (Arctic Sphynx)"

9.  You can now delete the previous app streams to get updates from the AlmaLinux Repo.

These steps shall work for any VPS running in CentOS with cPanel or Plesk system.