Skip to main content

Migrating from CentOS 8 to Rocky Linux or AlmaLinux

VDS / VPS · 19.04.2026 · 4 min read
Illustration for “Migrating from CentOS 8 to Rocky Linux or AlmaLinux”

In December 2021 CentOS 8 reached its end of life (EOL). If your server is still running CentOS 8, it no longer receives security updates. An urgent migration is required.

Comparison of CentOS successors

DistributionSponsorVersionsEOL (v9)
Rocky LinuxRocky Enterprise Software Foundation8, 92032
AlmaLinuxCloudLinux8, 92032
CentOS StreamRed Hat9, 102027
RHEL (paid)Red Hat8, 92032
💡 Which to choose: Rocky Linux and AlmaLinux are equally good. Rocky is slightly more conservative, AlmaLinux has a larger community contribution. Both provide binary compatibility with RHEL.

Migrating CentOS 8 → AlmaLinux 8

# Download the official migration script
curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

# Run it (always inside screen!)
sudo screen -S migration
sudo bash almalinux-deploy.sh

# When it finishes — reboot
sudo reboot

# Check the result
cat /etc/almalinux-release
rpm -qa | grep almalinux

Migrating CentOS 8 → Rocky Linux 8

# Download the migrate2rocky script
curl -O https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh
chmod +x migrate2rocky.sh

# Run it inside screen
sudo screen -S migration
sudo bash migrate2rocky.sh -r

# Reboot and verify
sudo reboot
cat /etc/rocky-release

After the migration

# Update all packages
sudo dnf update -y

# Check the repositories
dnf repolist

# Check the kernel
uname -r
rpm -q kernel
⚠️ CentOS 7: Reaches EOL in June 2024. Migration scripts to AlmaLinux 8 and Rocky Linux 8 are available as well, but require extra caution — a major upgrade (7→8) carries more risk. Deploying a fresh server is recommended.

Diagnosing common migration errors

The almalinux-deploy.sh script fails with "Failed to synchronize cache" — this usually means the old CentOS 8 repositories are already gone (mirrorlist.centos.org was shut down after EOL), and dnf cannot refresh metadata before the repositories get swapped.

Errors during downloading metadata for repository 'base':
  - Status code: 404 for http://mirrorlist.centos.org/?release=8&arch=x86_64&repo=BaseOS
Error: Failed to download metadata for repo 'base'

The fix is to first manually point the repositories at vault.centos.org (the archive) so dnf can download anything at all, and only then run the migration script.

sudo sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sudo sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

After migration, "dnf update" says "Problem: package X requires Y, but none of the providers can be installed" — a sign that some packages are still from CentOS (for example the kernel or a third-party module) while others are already from AlmaLinux/Rocky, and the versions clash.

Problem: package kernel-core-4.18.0-305.el8.x86_64 requires kernel-modules = 4.18.0-305.el8, but none of the providers can be installed

sudo dnf distro-sync usually fixes this — the command brings all packages to the versions of a single distribution instead of just updating them individually.

Migration paths compared

MethodEffortRiskWhen to choose it
Migration script (almalinux-deploy / migrate2rocky)MinutesModerate, depends on custom packagesA standard server with nothing exotic
New server plus data transferHours (moving the database, configs)Low for the systemProduction with high stability requirements
Switch to CentOS StreamMinutesHigh - rolling release, less predictableTest environments, not production

When a script migration is not the right call

  • The server has many custom packages from third-party repositories (EPEL forks, self-built RPMs) — the script may not handle the dependencies well, so moving data to a clean server is safer.
  • You need a guaranteed vendor support contract — Rocky and AlmaLinux are free but come with no commercial SLA; that requires RHEL specifically.
  • The server has not been updated for a long time and mixes packages from different CentOS 8.x minor versions — run dnf update on CentOS to the latest minor first, otherwise the script can fail with dependency errors.

Verifying the result

  1. Confirm the release changed: cat /etc/os-release must show AlmaLinux or Rocky Linux, not CentOS.
  2. Check for CentOS leftovers: rpm -qa | grep -i centos — the command must return no packages (aside from any centos-release-like package deliberately kept).
  3. Run a full update and confirm there are no conflicts: sudo dnf distro-sync must finish with no errors.
  4. Check the key services: systemctl status nginx mariadb — both must show active (running) after reboot.

After migrating, check the kernel version — see the article on updating the kernel, and the general planned OS update process is covered in the VDS update guide.

Was this article helpful?
← Back to Knowledge Base Ask Support