How to Migrate CentOS 7 to AlmaLinux 8: A Step-by-Step Guide

It’s now easier than ever to migrate from CentOS 7 to AlmaLinux 8, thanks to the AlmaLinux project called ELevate. Here's how to do it!

CentOS has long been popular for its stability, reliability, and long-term support. However, with the unexpected shift in CentOS’s strategy to focus on CentOS Stream, many users have found themselves seeking an alternative solution.

So, have you ever asked yourself, “How do I migrate from CentOS 7 to AlmaLinux?” You don’t need to worry about this anymore because this step-by-step guide will walk you through migrating your CentOS 7 installation to AlmaLinux 8, ensuring a smooth and hassle-free transition.

So far, so good, but how do we do it? For those unaware, the AlmaLinux ELevate project allows users to upgrade or migrate between any RHEL-based distro. So, let’s dive in and do it.

CentOS 7 to Alma Linux Upgrade Path

However, before we get to the action, there are a few key points we need to clear up, with the most important one being that it’s not possible to migrate from CentOS 7 to Alma 9 directly.

In other words, if you aim to transition to Alma 9, the path involves initially migrating your current CentOS 7 system to Alma 8. Once that’s done, you can then move on to upgrade from Alma 8 to 9. This two-step process ensures a smooth transition and compatibility across versions.

CentOS 7 to Alma Linux upgrade path.
CentOS 7 to Alma Linux upgrade path.

Here is our CentOS 7 system before starting the migration process to AlmaLinux 8.

CentOS 7 system before migration to AlmaLinux 8

1. Take System Backup

Before upgrading, please back up all your essential data and take a snapshot of the complete CentOS 7 system. This way, you will be on the right side if anything goes wrong.

Alternatively, you can always use a command like the one below to archive all the more important directories and their contents in a single tar.gz archive file.

sudo tar czf /centos7.tar.gz \
     --exclude=/centos7.tar.gz \
     --exclude=/dev \
     --exclude=/mnt \
     --exclude=/proc \
     --exclude=/sys \
     --exclude=/run \
     --exclude=/tmp \
     --exclude=/media \
     --exclude=/lost+found \
     /Code language: JavaScript (javascript)

Of course, you can add more “–exclude=” parameters if necessary. Finally, the command creates a backup of all the files and directories by placing them in the “centos7.tar.gz” archive in the root (/) partition.

Then, this file must be transferred to another computer or drive, for example, using the SCP command.

2. Upgrade the Current CentOS 7 System

The next step in the upgrade process is to ensure we have a wholly upgraded system. Update existing software with the following command:

sudo yum update

Once all the packages are updated, reboot your system to apply the changes.

Now, let’s verify the version of our current operating system.

cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)Code language: CSS (css)

The system runs CentOS 7.9, the latest version in the 7.x branch.

3. Migrate CentOS 7 to AlmaLinux 8

3.1 Install ELevate

The first step in the upgrade process is installing the “elevate-release” package on your current CentOS 7 system.

sudo yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpmCode language: JavaScript (javascript)
Installing the elevate-release package

3.2 Install Leapp and Migration Data

The migration process is based on using Red Hat’s Leapp utility. It combines Red Hat’s Leapp framework with a community-created library and service for its required migration metadata set.

So, the next step is to install the required packages for the upgrade from CentOS 7 to AlmaLinux 8.

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

3.3 Start a Pre-upgrade Check

The next step is to start a pre-upgrade check. The below command verifies server compatibility without any actual changes:

sudo leapp preupgrade

The check will probably fail, but don’t panic! That’s normal because some tweaks are required in advance.

CentOS 7 to AlmaLinux 8 migration -Preupgrade check

According to the official documentation, those three commands are shown below to solve the problem. Just run them one after the other:

sudo rmmod pata_acpi
echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config
sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=TrueCode language: PHP (php)

(Optional) If you rerun the check, the pre-upgrade check will succeed.

sudo leapp preupgrade
CentOS 7 to AlmaLinux 8 migration -Preupgrade check succeeded

3.4 Start the Upgrade Process from CentOS 7 to AlmaLinux 8

Now you can run the following command to migrate CentOS 7 to AlmaLinux 8.

sudo leapp upgrade

Be patient since the upgrade process could take some time. Once the migration is completed, you’ll be offered to reboot the system:

sudo reboot

A new entry in GRUB called ELevate-Upgrade-Initramfs will appear. Hit Enter and wait for the upgrade process to finish. The system will be automatically booted into it. 

ELevate Upgrade Initramfs

And you will be welcomed by the AlmaLinux 8 GRUB menu at boot time.

Alma Linux 8 Boot Menu

4. Check the OS Version

To confirm that you have successfully migrated from CentOS 7 to AlmaLinux 8, check the OS version:

cat /etc/redhat-release
AlmaLinux release 8.4 (Electric Cheetah)Code language: CSS (css)

That’s all. Congratulations! You have successfully migrated to AlmaLinux 8.

(Optional) In addition, you can update the server hostname to match with AlmaLinux.

sudo hostnamectl set-hostname almalinux8
sudo rebootCode language: JavaScript (javascript)
CentOS 7 to AlmaLinux 8: Migration succeeded

Conclusion

AlmaLinux’s ELevate tool is a great one! It may be a fantastic option if you want to migrate from CentOS 7 to AlmaLinux 8.

In addition, if you are running CentOS 8.x, all you have to do to switch to AlmaLinux 8 is follow our CentOS 8 to AlmaLinux 8: A Step-by-Step Migration Guide.

I have made this guide as simple as possible. Thanks for using it! Please share your thoughts in the comments box below.

Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.

Think You're an Ubuntu Expert? Let's Find Out!

Put your knowledge to the test in our lightning-fast Ubuntu quiz!
Ten questions to challenge yourself to see if you're a Linux legend or just a penguin in the making.

1 / 10

Ubuntu is an ancient African word that means:

2 / 10

Who is the Ubuntu's founder?

3 / 10

What year was the first official Ubuntu release?

4 / 10

What does the Ubuntu logo symbolize?

5 / 10

What package format does Ubuntu use for installing software?

6 / 10

When are Ubuntu's LTS versions released?

7 / 10

What is Unity?

8 / 10

What are Ubuntu versions named after?

9 / 10

What's Ubuntu Core?

10 / 10

Which Ubuntu version is Snap introduced?

The average score is 68%