How to Migrate CentOS 7 to AlmaLinux 8

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.

Table of Contents

Have you ever asked yourself: How do I migrate from CentOS 7 to AlmaLinux? You don’t need to worry about this anymore because it’s possible in just a few easy steps that I will show you in this guide.

This will be especially helpful for users of CentOS 7 who will be left without a clear upgrade path after the end of the year when Red Hat withdraws support for CentOS 8.

This is especially important because CentOS 7, which will lose support in 2024, is assumed to have a much larger user base than CentOS 8, which had only been available for a little over a year when Red Hat announced it was being sunsetted.

Related: CentOS Stream: Everything You Need to Know About it

For those unaware, the AlmaLinux ELevate project allows users to upgrade or migrate between any RHEL-based distro. So let’s do it.

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 make sure you take the backup of all your essential data and, if possible, take a snapshot of the complete CentOS 7 system. This way, you will be on the right side of things if anything goes wrong.

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 our current operating system version.

cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

As you can see, the system runs CentOS 7.9, which is the latest CentOS 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 an elevate-release package in your current CentOS7 system.

sudo yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm
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.

Therefore the next step is to install the required packages, which in our case, we wish to 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

Probably the check will 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=True

(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 the 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)

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 reboot
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.

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

Related: CentOS 8 to Rocky Linux 8 Migration: A Step-by-Step Tutorial

I have tried to make this guide as simple as possible. Thanks for using it! Feel free to share your thoughts in the comments box below.

3 Comments

Leave a Reply

Your email address will not be published.

  1. Hello,
    I tried the upgrade on CentOS 7.9, it froze on libvirtio (I’m writing from memory, it resembled something like that), then forced a reboot and now grub shows the old menu, Alma Linux tries to start, shows a lot of errors, then the cursor flashes and nothing else happens.
    I have no clue what to do from here! That server is now down, the upgrade failed.

  2. After solving the “inhibitors”, I always get the following error…

    ============================================================
    ERRORS
    ============================================================

    2022-05-14 15:14:39.704179 [ERROR] Actor: target_userspace_creator
    Message: Unable to install RHEL 8 userspace packages.
    Summary:
    Details: Command [‘systemd-nspawn’, ‘–register=no’, ‘–quiet’, ‘-D’, ‘/var/lib/leapp/scratch/mounts/root_/system_overlay’, ‘–setenv=LEAPP_NO_RHSM=0’, ‘–setenv=LEAPP_EXPERIMENTAL=0’, ‘–setenv=LEAPP_COMMON_TOOLS=:/etc/leapp/repos.d/system_upgrade/el7toel8/tools’, ‘–setenv=LEAPP_COMMON_FILES=:/etc/leapp/repos.d/system_upgrade/common/files:/etc/leapp/repos.d/system_upgrade/el7toel8/files’, ‘–setenv=LEAPP_UNSUPPORTED=0’, ‘–setenv=LEAPP_EXECUTION_ID=d5278bb5-e873-438d-b094-c7e1ebfcc069’, ‘–setenv=LEAPP_HOSTNAME=srv-net-072.alpaca.int’, ‘dnf’, ‘install’, ‘-y’, ‘–nogpgcheck’, ‘–setopt=module_platform_id=platform:el8’, ‘–setopt=keepcache=1’, ‘–releasever’, u’8.4′, ‘–installroot’, ‘/el8target’, ‘–disablerepo’, ‘*’, ‘–enablerepo’, u’almalinux8-baseos’, ‘–enablerepo’, u’almalinux8-powertools’, ‘–enablerepo’, u’almalinux8-resilientstorage’, ‘–enablerepo’, u’almalinux8-extras’, ‘–enablerepo’, u’almalinux8-highavailability’, ‘–enablerepo’, u’almalinux8-appstream’, ‘dnf’, ‘dnf-command(config-manager)’, ‘–disableplugin’, ‘subscription-manager’] failed with exit code 1.
    Stderr: Failed to create directory /var/lib/leapp/scratch/mounts/root_/system_overlay//sys/fs/selinux: Read-only file system
    Failed to create directory /var/lib/leapp/scratch/mounts/root_/system_overlay//sys/fs/selinux: Read-only file system
    Host and machine ids are equal (4e3bf1688a5744d698d980f621bf9021): refusing to link journals
    Failed to synchronize cache for repo ‘almalinux8-highavailability’, ignoring this repo.
    Failed to synchronize cache for repo ‘almalinux8-extras’, ignoring this repo.
    Failed to synchronize cache for repo ‘almalinux8-baseos’, ignoring this repo.
    Failed to synchronize cache for repo ‘almalinux8-appstream’, ignoring this repo.
    Failed to synchronize cache for repo ‘almalinux8-powertools’, ignoring this repo.
    Failed to synchronize cache for repo ‘almalinux8-resilientstorage’, ignoring this repo.
    Error: Unable to find a match: dnf dnf-command(config-manager)

    ============================================================
    END OF ERRORS
    ============================================================

    • Hello ArVie,
      I’m having the same problem here. I’ve tried several ways to overpass it but nothing seems to work.
      Have you found any fix to it?
      tx in advance.