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.

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

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
Code language: JavaScript (javascript)

Next, make the script executable:
chmod +x almalinux-deploy.sh
Code language: CSS (css)
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
Code language: CSS (css)
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.

Once the migration is completed, you will get:

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.

4. Check AlmaLinux Version to Validate Migration
To confirm that you have successfully migrated, check the OS version:
cat /etc/redhat-release

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
Code language: JavaScript (javascript)

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.