ClickCease How to Upgrade from CentOS 7 to AlmaLinux 9

Content Table

Join Our Popular Newsletter

Join 4,500+ Linux & Open Source Professionals!

2x a month. No spam.

How to Upgrade from Centos 7 to AlmaLinux 9

April 28, 2023 - TuxCare PR Team

AlmaLinux 9 was released in May 2022. At first, there was no easy upgrade path from AlmaLinux 8 to AlmaLinux 9. All upgrades required a fresh install. This also meant you couldn’t switch from CentOS to AlmaLinux 9. Thankfully, earlier this year, AlmaLinux added AlmaLinux 9 to its ELevate program.

With this addition, there is now a way to upgrade from CentOS 7 to AlmaLinux 9. However, the process involves first upgrading from CentOS 7 to AlmaLinux 8, and then from AlmaLinux 8 to AlmaLinux 9 – so it is really a two-stage process.


What Is ELevate?


The process you’re going to follow is based on the AlmaLinux ELevate feature which aims to help users switch from CentOS to AlmaLinux – but which can be used to upgrade to and switch between many RHEL-based Linux distributions.

ELevate utilizes a tweaked version of Red Hat’s Leapp framework as well as a data library and toolset called the Package Evolution Service. ELevate runs a pre-upgrade check to alert you of potential issues, but in most instances, it performs as promised and allows you to switch between RHEL distributions.


Why Switch from CentOS 7 to AlmaLinux 9?


CentOS 7 is scheduled for end of life on June 30, 2024, so you have about a year to switch – but switch you must, as running end of life software is simply too risky.

Based on Kernel 5.14, AlmaLinux 9 is the first release of AlmaLinux and it stems from CentOS Stream this time. It has reached architecture parity with upstream, becoming the first distribution to do so, and includes enhancements to automation and web cockpit, security, and the application development environment.

But why not just do a one-stage process and simply switch to AlmaLinux 8? Whether you need the new features or not, it’s also worth thinking about ongoing support for AlmaLinux 8. You have plenty of years left there for security support (until March 2029), but active support ends May 2024.

On the flip side, AlmaLinux 9 will enjoy security support until 2032, and active support until May 2027. You could be saving yourself a lot of hassle by doing the switch to AlmaLinux 9 in one go.


Stage One: CentOS 7 to AlmaLinux 8 


There are significant differences between CentOS 7 and CentOS 8, and by implication also significant differences between CentOS 7 and AlmaLinux 8 – that’s because both CentOS 8 and AlmaLinux 8 are based on RHEL 8.

But, thanks to the ELevate project from AlmaLinux, it’s relatively simple to switch from CentOS 7 to AlmaLinux.

First, update your CentOS 7 instance to the latest version, followed by a reboot:

sudo yum update -y

sudo reboot


You then need to install the elevate-release package that contains the project repo:

sudo yum install -y

Next, install the leapp packages and migration data for AlmaLinux:

sudo yum install -y leapp-upgrade leapp-data-almalinux


Then, do a pre-upgrade check using this command:

sudo leapp preupgrade

The results will be posted in this file – /var/log/leapp/leapp. In most cases, the check will fail, and you’ll get some recommended solutions.

There are common issues migrating from CentOS 7. You can address these common issues by running the following set of commands:

Module pata_acpi inhibits upgrade, run this command to fix it:

sudo rmmod pata_acpi


Lack of root login access (can break post-upgrade remote system access). Run this command to enable it. It can be disabled again after upgrading.

echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config


Unsupported pam module, run this command to fix it:

sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True


Another common issue is timeout during package download, which can be fixed by simply retrying the command. Yum, used during the upgrade process, caches already downloaded packages, so your system will only retry the missing packages.


Your next step is to start the upgrade and trigger a reboot. The operation might seem to stall after deploying the updated packages, but it will finish eventually.

sudo leapp upgrade

This is what you want to see after the tool runs successfully (with different package numbers):

sudo reboot


Once the reboot is executed, you’ll see a new entry in GRUB: ELevate-Upgrade-Initramfs. Press Enter and wait for the upgrade process to finish.


You’ll then boot into AlmaLinux. After the reboot, you can verify that you’re now running AlmaLinux 8:

cat /etc/redhat-release

You should see AlmaLinux alongside the current version number.


Stage Two: AlmaLinux 8 to AlmaLinux 9


Now that you’ve switched from CentOS 7 to AlmaLinux 8, you need to upgrade to the latest version of AlmaLinux, which you’ll again do with ELevate. 

Start by downloading the elevate-testing repo:

sudo curl -o /etc/yum.repos.d/elevate-testing.repo

Next, import the ELevate GPG key:

sudo rpm --import

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 /var/log/leapp/leapp-report.txt

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.


You then need to reboot:

sudo reboot


You may also need to set AllowZoneDrifting to no

$ sudo vim /etc/firewalld/firewalld.conf



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.

This is the message that you want to see at the end of this process:


The text in green is the indication that all went well and the system is ready to upgrade. A message in red means that there are still some upgrade blockers that demand attention. As mentioned previously, you can find all of the information in the log files and it will usually include some instructions on how to solve each of those blockers.


 You can then trigger the upgrade:

sudo leapp upgrade

After a period of time, you’ll need to reboot your system, so:

sudo reboot


A new entry in GRUB called ELevate-Upgrade-Initramfs will appear and your system will automatically boot into it. 

You can confirm that you’re now running AlmaLinux 9 using the following command line:

$ cat /etc/os-release


And You’re Done!


Follow the steps above and you’ve brought your CentOS 7 machine lots of extra years of ongoing support, which means it’ll be running safely and securely until 2032. That’s plenty of time to switch to AlmaLinux 10!


How to Upgrade from Centos 7 to AlmaLinux 9
Article Name
How to Upgrade from Centos 7 to AlmaLinux 9
Learn the way to upgrade from CentOS 7 to AlmaLinux 9. However, the process involves first upgrading from CentOS 7 to AlmaLinux 8
Publisher Name
Publisher Logo

Looking to automate vulnerability patching without kernel reboots, system downtime, or scheduled maintenance windows?

Learn About Live Patching with TuxCare

Become a TuxCare Guest Writer

Get started




Linux & Open Source

Subscribe to
our newsletter