CentOS 8 to AlmaLinux Migration Guide
In this article
This guide walks you through migrating a CentOS 8 system to AlmaLinux 8, a free, community-owned RHEL-compatible distribution. The process uses the official almalinux-deploy script, which replaces CentOS repositories and packages with AlmaLinux equivalents while preserving your data, applications, and configurations. Before starting, ensure you have a full backup and root or sudo access.
What You'll Need
- A CentOS 8 system (8.5 or later) with internet access
- Root or sudo privileges
- A full backup of critical data (test the restore process)
- At least 1 GB of free disk space
- Optional: a rescue environment (e.g., live USB) for recovery
Step-by-Step
- Back up your system. Use tools like
rsyncortarto back up important files. If you have a separate /home partition, back that up too. Verify the backup is restorable. - Update CentOS 8 fully. Run
sudo dnf update -yand reboot if a kernel update was applied. Ensure your system is on the latest CentOS 8 packages to reduce migration issues. - Install the AlmaLinux deploy script. Download it from the official AlmaLinux repo:
curl -O https://repo.almalinux.org/almalinux/8.10/BaseOS/x86_64/os/Packages/almalinux-deploy-8.10-1.el8.noarch.rpm(adjust version if needed). Install it withsudo dnf install ./almalinux-deploy-*.rpm. - Run the migration script. Execute
sudo almalinux-deploy. This will replace CentOS repositories with AlmaLinux ones and reinstall core packages. The script may take 10–20 minutes depending on your system. - Check for errors. The script outputs progress. If it fails, note the error message—common issues are missing GPG keys or network problems. If it succeeds, you'll see a completion message.
- Reboot the system. Run
sudo reboot. After reboot, verify the OS:cat /etc/redhat-releaseshould show AlmaLinux release 8.x. - Clean up. Remove the deploy script and old CentOS packages:
sudo dnf remove almalinux-deployandsudo dnf clean all. Then runsudo dnf updateto apply any remaining AlmaLinux updates.
Common Mistakes
- Skipping the full update. Migrating from an outdated CentOS 8 can cause dependency conflicts. Always update first.
- Ignoring the backup. Even though the script is reliable, a failed migration can leave the system unbootable. A backup is your safety net.
- Running the script as a non-root user. The script requires root privileges. Use
sudoor log in as root. - Using a third-party migration tool. Stick to the official
almalinux-deploy—other scripts may be outdated or unsafe. - Not checking the release version. Ensure you're on CentOS 8, not CentOS 7 or 9. The script only works for 8.
Tips
- Do the migration during a maintenance window, as the system will be unavailable during the reboot.
- If you have custom repositories (e.g., EPEL), they will remain but may need updating. Check
/etc/yum.repos.d/after migration. - For servers with SELinux enabled, the script handles relabeling automatically, but you can run
sudo touch /.autorelabelbefore reboot to force a full relabel if needed. - Keep a log of the migration output:
sudo almalinux-deploy 2>&1 | tee migration.logfor troubleshooting.
Troubleshooting
- Script fails with GPG key error. This often happens if the AlmaLinux key is not imported. Run
sudo rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinuxand retry. - System won't boot after migration. Boot into a rescue environment (live CD) and check
/etc/redhat-release. If it still says CentOS, the migration didn't complete—restore from backup and retry. - DNF errors after migration. Run
sudo dnf clean allandsudo dnf makecache. If errors persist, check repository files in/etc/yum.repos.d/for leftover CentOS entries and replace them with AlmaLinux mirrors. - Kernel panic on boot. This is rare but can happen if the initramfs is corrupted. Boot into rescue mode and run
sudo dracut -fto rebuild it. - Missing packages after migration. Some CentOS-specific packages may not have AlmaLinux equivalents. Use
sudo dnf list installed | grep centosto find them and remove or replace as needed.
Frequently Asked Questions
Is the migration reversible?
No, the script replaces CentOS packages with AlmaLinux ones. To revert, you'd need to restore from backup or reinstall CentOS.
Will my applications and data be preserved?
Yes, the migration only changes system packages and repositories. Your files, applications, and configurations remain intact.
Do I need to reinstall any drivers or kernel modules?
No, AlmaLinux uses the same kernel and drivers as CentOS 8. They will be updated to AlmaLinux versions automatically.
How long does the migration take?
Typically 10–20 minutes for the script, plus a reboot. Large systems with many packages may take longer.
Can I migrate from CentOS 8 Stream?
No, the script is designed for CentOS 8 Linux, not Stream. Stream users should consider a fresh install of AlmaLinux.
Is AlmaLinux truly free?
Yes, AlmaLinux is free and open-source, maintained by the AlmaLinux OS Foundation. It is binary-compatible with RHEL.