Join Our Popular Newsletter
Join 4,500+ Linux & Open Source Professionals!
2x a month. No spam.
How to Upgrade from Centos 8 to AlmaLinux 9
In May 2022, the AlmaLinux Foundation launched AlmaLinux 9. At first, there wasn’t a straightforward method for upgrading from AlmaLinux 8 to AlmaLinux 9, so you needed to do a clean installation. That meant you couldn’t migrate from CentOS 8 to AlmaLinux 9 either.
Thankfully, AlmaLinux updated the ELevate program earlier this year to include AlmaLinux 9. However, you need to handle any upgrade as a two-step process. Upgrade from CentOS 8 to AlmaLinux 8 first, followed by upgrading from AlmaLinux 8 to AlmaLinux 9.
So, let’s dive into the steps you’ll need to take when migrating from CentOS 8 to AlmaLinux 9 and why this might be the best distribution journey for your organization.
Why Switch from CentOS 8 to AlmaLinux 9?
CentOS 8 reached end of life on December 31, 2021, so anyone still using it is running an OS with no official support. No new patches are being released for CentOS 8, so if hackers try to get into your system using a vulnerability discovered in 2022 and 2023, they will find it easy to do.
You can’t really downgrade to CentOS 7, and even if you managed to do so you’d only get about a year’s extra support. Yes, you could opt for a one-stage process and simply switch to AlmaLinux 8. But even if you don’t need the new features, it’s still worth thinking about what ongoing support will look like for AlmaLinux 8 in the coming years.
So yes, with AlmaLinux 8 there is security support until March 2029, but active support ends May 2024. AlmaLinux 9 will enjoy active support until May 2027 and security support until 2032. It’s a long time to think ahead, but it’s worth considering because, after all, you’re currently using CentOS 8 beyond its lifespan.
Stage One: CentOS 8 to AlmaLinux 8
Your first step is to convert your CentOS 8 system into an AlmaLinux 8 system using a conversion script. To start, check which version of CentOS 8 you’re running:
If the reported OS version is lower than 8.5, you need to change the paths to repositories:
sed -i -r 's|^(mirrorlist.+)$|#\1|g; s|^#baseurl=http://mirror.centos.org/\$co
Then, apply pending updates to your CentOS 8 instance, followed by a reboot:
sudo yum update -y sudo reboot
Next, install the migration script almalinux-deploy.sh
curl -0 https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
Then, run the migration script:
sudo bash almalinux-deploy.sh
This will take some time. You should see a confirmation screen with the following text:
Migration to AlmaLinux is completed
You might find that the script fails. The script run may fail with an error like:
Verify almalinux-release-latest.rpm package ERROR
/root/.alma.X46iDx/almalinux-release-latest.rpm: digests SIGNATURES NOT OK
If that’s the case, you should first import the GPG key of the AlmaLinux repository and then run the script again:
sudo rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux && sudo bash almalinux-deploy.sh
Your next step is to check that the conversion succeeded.
You should see:
AlmaLinux release 8.7 (Stone Smilodon)
Now, reboot: sudo reboot
Stage Two: AlmaLinux 8 to AlmaLinux 9
Now that you’ve switched from CentOS 8 to AlmaLinux 8, you need to upgrade to the latest version of AlmaLinux, which you’ll do through ELevate.
Start by downloading the elevate-testing repo:
sudo curl https://repo.almalinux.org/elevate/testing/elevate-testing.repo -o /etc/yum.repos.d/elevate-testing.repo
Next, import the ELevate GPG key:
sudo rpm --import https://repo.almalinux.org/elevate/RPM-GPG-KEY-ELevate
Then, install the Leapp packages that enable you to upgrade from AlmaLinux 8 to AlmaLinux 9:
$ sudo yum install -y leapp-upgrade leapp-data-almalinux
You should see confirmation that the packages were installed. Next, as with the previous stage, you need to first run a pre-upgrade check using the following command:
sudo leapp preupgrade
As before, you can view the results in
Common problems you’ll find are around SELinux and Firewalld Configuration AllowZoneDrifting.
You can fix these issue as follows:
To disable SELinux:
$ sudo vim /etc/sysconfig/selinux ##Change selinux mode to Disabled. SELINUX=disabled
You then need to reboot:
You may also need to set AllowZoneDrifting to no
$ sudo vim /etc/firewalld/firewalld.conf AllowZoneDrifting=no
Another blocker is that you need to be running the latest installed kernel version, so ensure that is the case and reboot into the latest version if you’re not yet doing that.
It’s worth re-running the pre-upgrade command to check that you’re good to go.