In December 2020, Red Hat accounted that it would discontinue CentOS based on RedHat releases. Naturally, this came as quite a shock for the CentOS community. However, this change resulted in a couple of exciting CentOS forks. The first announced was Rocky Linux.
As you know, CentOS 8 reached its End-of-Life in December 2021. So if you want to migrate your CentOS 8 server to Rocky Linux 8, a 1:1 binary compatible with CentOS and RHEL, follow the steps.
How to Migrate CentOS 8 to Rocky Linux 8
Note: Before performing the below migration commands, it is always recommended to backup all critical data from your CentOS system.
Step 1: Update/Upgrade the Current CentOS System
Go to your CentOS and upgrade your system to ensure all the packages are up to date.
sudo dnf -y upgrade
After the upgrade is completed, reboot your system to ensure all changes are applied, including kernel-related changes.
sudo reboot
Step 2: Get migrate2rocky Conversion Script
Rocky Linux provides a tool called migrate2rocky, tested successfully on several 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
Code language: JavaScript (javascript)
2.2 Make the script executable.
chmod +x migrate2rocky.sh
Code language: CSS (css)
Step 3: Start the Migration Process from CentOS to Rocky Linux
Finally, with the local script, run it with the -r
option to migrate from CentOS 8 to Rocky Linux 8.
sudo bash migrate2rocky.sh -r
Code language: CSS (css)
Preparing to migrate CentOS Linux 8 to Rocky Linux 8.
Determining repository names for <a href="https://linuxiac.com/centos-replacements-for-your-production-linux-servers/">CentOS Linux</a> 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
...
Code language: HTML, XML (xml)
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
Code language: JavaScript (javascript)
Run the following command to sync installed packages and then reboot the system.
sudo dnf distro-sync -y
sudo reboot

Step 4: Check the OS version
To confirm you have successfully migrated to Rocky Linux, check the OS version.
cat /etc/redhat-release
Rocky Linux release 8.4 (Green Obsidian)
Code language: CSS (css)
Congratulations! You have successfully migrated CentOS Linux 8 to Rocky Linux 8.

Doesn’t work doing that,
disable UEFI boot and migrate
For professional use of CentOS 8, Rocky Linux seems to be not supporting EFI Secure Boot:
sudo bash migrate2rocky.sh -r
Removing dnf cache
EFI Secure Boot is enabled but Rocky Linux doesn’t provide a signed shim yet. Disable EFI Secure Boot and reboot.
An error occurred while we were attempting to convert your system to Rocky Linux. Your system may be unstable. Script will now exit to prevent possible damage