This easy to follow step-by-step tutorial explains how to migrate from CentOS 8 to Rocky Linux 8 by using the migrate2rocky script.
Back in December 2020, Red Hat accounted that it will be discontinuing CentOS based on RedHat releases. This was come as quite a shock for the CentOS community. This change resulted in a couple of exciting CentOS forks. The first announced was Rocky Linux.
As you know, CentOS 8 will reach its End-of-Life in December, 2021. If you want to migrate your CentOS 8 server to Rocky Linux 8 which is a 1:1 binary compatible with CentOS and RHEL, then here are the steps to follow.
Steps to Migrate and Replace CentOS 8 with Rocky Linux 8
Note: Before performing the below migration commands, it is always recommended to backup all important data from your CentOS system.
1. Update/Upgrade the Current CentOS System
Go to your CentOS and upgrade your system, to make sure all the packages are up.
sudo dnf -y upgrade
After upgrade is completed, reboot your system to make sure all changes are applied including kernel-related changes.
2. Get migrate2rocky Conversion Script
Rocky Linux provides a tool called
migrate2rocky which has been tested successfully on a number of RHEL variants such as CentOS, Alma Linux, and Oracle Linux. The
migrate2rocky script can be used for convenient, in-place migration to Rocky Linux.
2.1 Download the script using the curl command shown below.
curl -O https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh
2.2 Make the script executable.
chmod +x migrate2rocky.sh
3. Start the Migration Process from CentOS to Rocky Linux
Finally, with the script available locally, run it with
-r option to migrate from CentOS 8 to Rocky Linux 8.
sudo bash migrate2rocky.sh -r
Preparing to migrate CentOS Linux 8 to Rocky Linux 8. Determining repository names for CentOS Linux 8….. Found the following repositories which map from CentOS Linux 8 to Rocky Linux 8: CentOS Linux 8 Rocky Linux 8 appstream appstream baseos baseos extras extras ...
The script will automatically change the CentOS 8 Linux repos to Rocky Linux repos. Be patient since the upgrade process could take some time.
Once the migration is completed, you will get:
... Done, please reboot your system. A log of this installation can be found at /var/log/migrate2rocky.log
Run the following command to sync installed packages and then simply reboot the system.
sudo dnf distro-sync -y sudo reboot
4. Check the OS version
Just to confirm you have successfully migrated to Rocky Linux, check the OS version.
Rocky Linux release 8.4 (Green Obsidian)
Congratulations! You have successfully migrated CentOS Linux 8 to Rocky Linux 8.