How to Upgrade from Centos 7 to AlmaLinux 9
- Upgrading from CentOS 7 to AlmaLinux 9 is now more critical due to CentOS 7’s end of life.
- You can use ELevate to upgrade from CentOS 6 or 7 to AlmaLinux 8 or other preferred RHEL-based 8.x distributions
- Don’t let CentOS 7 EOL expose you to risks. Secure your workloads with TuxCare’s Extended Lifecycle Support.
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 very easily. Thankfully, 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, though an easy one.
What Is ELevate?
The upgrade process you’re going to follow is based on the AlmaLinux ELevate upgrade tool, which aims to help users switch from CentOS to AlmaLinux – but it can be used to upgrade to other RHEL-based Linux distributions in addition to AlmaLinux.
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 reached the end of life on June 30, 2024 and running an end-of-life OS is simply too risky. With no more security updates, it exposes your systems to vulnerabilities, which can lead to breaches and compliance issues. Upgrading to AlmaLinux 9 ensures you continue receiving updates and security fixes for years to come.
Based on Kernel 5.14, AlmaLinux 9 is the second major 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 its active support ended in 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 8.
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
http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm
The Leapp utility facilitates the migration from CentOS 7 to AlmaLinux 9. 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 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
/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
SELINUX=disabled
You then need to reboot:
sudo 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.
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 bought your CentOS 7 machine plenty 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!
Related Article: How to Upgrade from Centos 8 to AlmaLinux 9
Final Thoughts
Migrating from CentOS 7 to AlmaLinux 9 can help organizations maintain security, compliance, and access to the latest software packages. To further enhance the AlmaLinux 9 experience and maximize its potential, consider TuxCare’s Enterprise Support for AlmaLinux. With a 16-year support lifecycle, commercial repository, break-and-fix support, extended security updates with continuous FIPS compliance, and affordable pay-as-you-go application support, TuxCare offers comprehensive coverage for your AlmaLinux environment.
Have questions about upgrading to AlmaLinux or need expert guidance? Our team is ready to assist you. Ask Us a Question.
Need more time to migrate from CentOS 7? Secure your systems and gain peace of mind with our Extended Lifecycle Support for CentOS 7.