Switching from CentOS to AlmaLinux
AlmaLinux is proving to be a popular alternative to the now-nearly-dead CentOS stable release. However, plenty of CentOS 7 and 8 users are still using CentOS as their main computing platform and have yet to switch.
Staying on CentOS 8 isn’t an option – official support for CentOS 8 ended December 31, 2021. For CentOS 7, you have until the end of June 2024 before support ends. And you don’t want to wing it without official support. You could consider switching to CentOS Stream, if your workload will even work on it.
Switching to AlmaLinux is a sensible alternative, as AlmaLinux is intended as a 1:1 binary compatible drop-in replacement. Thankfully, it is relatively easy to switch from CentOS to AlmaLinux. In this article, we’ll look at the steps you need to take to migrate to AlmaLinux from CentOS 8, and the different set of steps you need to take for migrating from CentOS 7.
Preparing for the switch
While the operation is traditionally safe, caution dictates that, as a first step, you need to ensure that you have a snapshot or full backup of your systems in place, just in case something goes wrong. Particularly when migrating from CentOS 7 to AlmaLinux, there is a risk that a minor compatibility problem will give you a real headache, in which case you’ll be grateful you had a backup.
One way to get ahead of potential problems is to perform a trial run using a sandboxed version of your OS. It is also worth verifying which version of CentOS you’re running by using this command:
You should receive output that includes the following two lines:
NAME="CentOS Linux" VERSION="8 (Core)"
Where VERSION of course refers to the CentOS version you’re running.
CentOS 7 to AlmaLinux 8 using ELevate
Migrating from CentOS 7 to AlmaLinux 8 is more challenging than migrating from CentOS 8 because, just as there are significant differences between CentOS 7 and CentOS 8, there are also significant differences between CentOS 7 and AlmaLinux 8. After all, both CentOS 8 and AlmaLinux 8 are based on RHEL 8.
However, thanks to the ELevate project from AlmaLinux, it’s much easier than it would otherwise be. In this section we’ll explain how you use ELevate 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 http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm
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:
sudo rmmod pata_acpi
Lack of root login access (can break post-upgrade remote system access). Can be disabled again after upgrading:
echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config
Unsupported pam module:
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.
sudo leapp upgrade
This is what you want to see after the tool runs successfully (with different package numbers):
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:
You should see AlmaLinux alongside the current version number.
CentOS 8 to AlmaLinux 8
AlmaLinux and CentOS 8 are strikingly similar, which makes the transition between the two relatively effortless. Only minor changes are needed to switch from CentOS release 8 to AlmaLinux. When you switch, you replace CentOS repositories with AlmaLinux repositories, and a few other packages are substituted.
In this section, we assume you’re running CentOS 8.5 or higher. If you’re using an earlier version, you need to update it to CentOS 8.5 before you proceed.
To begin the upgrade process, first ensure that all packages are up to date. You can do that by executing the following command:
sudo dnf update -y
Once all packages have been updated, you need to reboot your system to apply the changes:
Run this command to download the almalinux-deploy.sh script:
As a best practice, you should always check scripts you download from the Internet before running them on your system, so check the content of the downloaded file and confirm there is no unexpected behavior contained within.
Add execute permissions to the script:
chmod +x almalinux-deploy.sh
Now, run the script you just downloaded
sudo bash almalinux-deploy.sh
If you have already upgraded your system to CentOS 8 Stream (which can happen during regular update operations), you’ll need to add the ‘-d’ parameter to the previous script. Otherwise, the script will not run and will let you know in the output.
After the script executes successfully, you need to reboot:
You can then verify that AlmaLinux was installed successfully by running:
Which should respond with AlmaLinux and the release number.
Not ready to switch?
For most use cases, switching from CentOS to AlmaLinux is a simple, straightforward process. In principle, we’d say switch as fast as you can – there’s no time left with CentOS 8, and little time left with CentOS 7.
If you really need to continue to use CentOS past its end-of-life date you can consider extended support. TuxCare can offer you extended support for both versions. We also offer enterprise-grade support for AlmaLinux.