CentOS 8 to AlmaLinux 8: A Step-by-Step Migration Guide

CentOS 8 to AlmaLinux 8: A Step-by-Step Migration Guide

This guide will help you to migrate in-place your current CentOS 8 installation to AlmaLinux 8 in a few simple steps.

As you know, CentOS 8 reached its End-of-Life on December 31, 2021. If you want to migrate your CentOS 8 server to AlmaLinux 8, a 1:1 binary compatible with CentOS and RHEL, follow the steps below.

An in-place upgrade involves using the official AlmaLinux automated script to migrate your current CentOS 8 operating system files to AlmaLinux.

In addition, an in-place upgrade does not require formatting of the hard disk, and due to that fact, all settings, programs, and files on your current CentOS 8 system will be preserved.

Steps to Migrate CentOS 8 to AlmaLinux 8

Here’s our CentOS 8 system before starting the migration process to AlmaLinux.

Sysytem Information Before Upgrade

1. Take System Backup

Before upgrading, please make sure you take the backup of all your important data and, if possible, take a snapshot of the complete CentOS 8 system. This way, you will be on the right side of things if anything goes wrong.

2. Upgrade the Current CentOS 8 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 dnf 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
Checking the Current CentOS 8 Version

3. Download the Official AlmaLinux Migration Script

The first step in the actual upgrade process is to download the almalinux-deploy.sh script from the AlmaLinux GitHub repo:

curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
almalinux-deploy.sh Migration Script

Next, make the script executable:

chmod +x almalinux-deploy.sh

3. Migrate from CentOS 8 to AlmaLinux 8

Finally, with the script available locally, run it to start the migration process:

sudo bash almalinux-deploy.sh

After the migration script performs a few initial checks, it will begin upgrading specific packages to synchronize the system with the current AlmaLinux 8 release.

Be patient since the upgrade process could take some time.

CentOS 8 to AlmaLinux 8 Migration in Progress

Once the migration is completed, you will get:

Migration from CentOS 8 to AlmaLinux 8 Completed Successfully

Run the following command to sync installed packages and then reboot the system:

sudo dnf distro-sync -y
sudo reboot

The GRUB menu will appear with the AlmaLinux entry at the very top. Just hit Enter or wait a sec, and it will boot automatically into AlmaLinux 8.

AlmaLinux 8 Bootloader

4. Check AlmaLinux Version to Validate Migration

To confirm that you have successfully migrated, check the OS version:

cat /etc/redhat-release
Check the OS Version

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

(Optional) In addition, you can change the server hostname to match with AlmaLinux:

sudo hostnamectl set-hostname almalinux8
sudo reboot
AlmaLinux 8 System Information

Conclusion

Please note that the almalinux-deploy.sh script will only convert CentOS 8 version to AlmaLinux 8. If you are running an older version like CentOS 7.x, all you have to do to switch to AlmaLinux 8 is follow our detailed guide – How to Migrate CentOS 7 to AlmaLinux 8: A Step-by-Step Guide.

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.

Bobby Borisov
Bobby Borisov

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

6 Comments

  1. Hello,
    is “dnf distro-sync -y” after the script execution?
    i see the script executes it (line in green after “Complete!”)

    Awesome tutorial!

    • Hi Grim,

      Yes, you are absolutely right. In this case we are running it manually just to make sure that everything is done properly before rebooting the system.

      Thank you for reading Linuxiac!

  2. Hi Bobby,
    Thanks for your work searching for CentOS replacement. I have some questions, forgive me if they were answered elsewhere.
    Is it possible to migrate from current CentOS Stream version? Will the script downgrade newest packages or will it keep them installed?
    I wanted to use CentOS, seduced by its ability to be up to date quicker than RedHat. But I use old hardware (SAS mpt3 and Net be2net) that need elrepo ports of modules previously supported in RH7 versions, and such ports are based on RedHat kernel releases. Latest is for 4.18.0-348.2.1.el8_5 kernel, outdated by current Stream version. I find quite dangerous to update excluding kernel, I’ve been doing that for a few weeks, so I resign to use a RedHat clone.

    • Hi Philippe,

      Unfortunately, I don’t think there are currently any official migration options from CentOS Stream to Alma, Rocky, or other CentOS replacements. This is because we are talking about migration from a rolling release distro to a point release one, which I think is quite difficult to accomplish. In fact, Stream isn’t RHEL compatible OS. That is converting like a downgrade so that it may be hazardous.

      However, you can find something on the subject on the internet (https://gist.github.com/grizz/e3668652c0f0b121118ce37d29b06dbf), but my personal opinion is that such a step is extremely risky, and if we are talking about a production server, it should not cross your mind to try.

      Best,
      Bobby

Leave a Reply

Your email address will not be published. Required fields are marked *