CentOS Linux 8 reached its end of life on December 31, 2021, and CentOS 7 followed in June 2024. If you still run CentOS, your servers no longer receive security updates. The good news: you do not need to reinstall everything. In this guide you will learn how to migrate CentOS to Rocky Linux, first converting CentOS 8 to Rocky Linux 8 with migrate2rocky, and then performing an in-place upgrade to Rocky Linux 9 with the ELevate tool. A safer fresh-install alternative is covered at the end.
Before You Migrate CentOS to Rocky Linux – How to Migrate from CentOS 8
An in-place migration rewrites your operating system while it is running. Treat it like surgery: prepare a rollback plan first.
- Take a full backup or a VM snapshot. Test that you can restore it. Every migration guide, including the official Rocky documentation at docs.rockylinux.org, starts with this warning.
- Update the system fully and reboot into the newest kernel.
- Remove or disable third-party repositories that do not support Rocky Linux. Unknown repos are the top cause of failed conversions.
- Check free disk space: you need several GB free in
/varand/usrfor downloaded packages.
cat /etc/centos-release
dnf upgrade -y
reboot
Option 1: Convert CentOS 8 to Rocky Linux 8 – How to Migrate from CentOS 8
The Rocky Linux project provides migrate2rocky, a script that swaps CentOS repositories and packages for the Rocky equivalents. It supports conversions from CentOS 8 (and other EL8 clones) to Rocky Linux 8.
curl -O https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/tools/migrate2rocky/migrate2rocky.sh
chmod +x migrate2rocky.sh
sudo ./migrate2rocky.sh -r
The -r flag performs the full conversion. The script replaces the release packages, re-syncs every installed package with the Rocky repositories and reinstalls the bootloader if needed. Depending on your connection this takes 15–45 minutes. When it completes, reboot and verify:
reboot
cat /etc/rocky-release
dnf distro-sync -y
The output should read Rocky Linux release 8.x. Check that your services still start and your applications work before moving on.

Option 2: In-Place Upgrade from Rocky 8 (or CentOS 8) to Rocky Linux 9
Major-version upgrades are handled by ELevate, an AlmaLinux project built on Red Hat’s Leapp framework, which supports upgrading EL8 systems to Rocky Linux 9. Install the ELevate release package and the Rocky upgrade data:
sudo dnf install -y http://repo.almalinux.org/elevate/elevate-release-latest-el8.noarch.rpm
sudo dnf install -y leapp-upgrade leapp-data-rocky
Run the pre-upgrade check. Leapp analyses your system and reports “inhibitors” — problems that must be fixed before upgrading, such as unsupported kernel modules or conflicting packages.
sudo leapp preupgrade
cat /var/log/leapp/leapp-report.txt
Fix every inhibitor. Common ones include removing old kernels, answering configuration questions in /var/log/leapp/answerfile, and disabling extra repositories. Then start the upgrade and reboot:
sudo leapp upgrade
reboot
The system boots into a special upgrade environment, converts the packages, and reboots into Rocky Linux 9. Verify the result:
cat /etc/rocky-release
uname -r
sudo dnf check
systemctl --failed
Option 3: Fresh Install and Data Migration (Safest)
For production systems with paying customers, the lowest-risk path is a clean installation on new hardware or a new VM: install Rocky Linux 9, reinstall your stack, then copy data with rsync and import databases. You keep the old server untouched as an instant rollback, and you can switch over with a DNS change during a maintenance window. This is the method we recommend for hosting servers.
Post-Migration Checklist
- Confirm every service is enabled and running:
systemctl --failedandsystemctl list-unit-files --state=enabled. - Review firewall rules:
firewall-cmd --list-all. - Check SELinux denials in
/var/log/audit/audit.log— policies can change between major versions. - Re-enable any third-party repositories that publish Rocky Linux 9 builds.
- Run a full update:
sudo dnf upgrade -y.
Troubleshooting
- migrate2rocky stops with package conflicts: remove the conflicting third-party package, run the script again, and reinstall a Rocky-compatible version afterwards.
- Leapp reports the system as unsupported: make sure Secure Boot is disabled during the upgrade and that you are on the latest EL8 point release.
- The upgrade environment fails to boot: select the previous kernel in GRUB, boot the old system and read
/var/log/leapp/leapp-upgrade.logfor the exact error.
What About CentOS Stream and Other EL8 Systems?
The same approach works beyond classic CentOS 8. migrate2rocky also accepts other EL8 derivatives, and ELevate publishes upgrade data for several targets, so an Oracle Linux 8 or AlmaLinux 8 machine can follow a very similar path to Rocky Linux 9. CentOS Stream 8 is a special case: it tracks slightly ahead of RHEL, so the recommended route is a conversion to Rocky 8 first, a full dnf distro-sync to settle every package onto the Rocky versions, and only then the Leapp upgrade. Whatever your starting point, keep the snapshot until the migrated system has survived at least one full backup cycle and one round of regular updates in production.
Conclusion
You now have three proven ways to migrate CentOS to Rocky Linux: the quick migrate2rocky conversion, the ELevate in-place upgrade to version 9, and the safe fresh-install route. After migrating, continue with the Rocky Linux 9 server setup and hardening guide to lock the system down, and consider migrating any remaining AlmaLinux machines as well — the same Leapp workflow works there too.