CentOS 8 to Rocky Linux 8 Migration: A Step-by-Step Tutorial

This easy-to-follow step-by-step tutorial explains how to migrate from CentOS 8 to Rocky Linux 8 using migrate2rocky script.

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 CentOSAlma 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.shCode 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 -rCode 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.logCode language: JavaScript (javascript)

Run the following command to sync installed packages and then reboot the system.

sudo dnf distro-sync -y
sudo reboot
Rocky Linux 8 Grub Screen

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.

Rocky Linux 8 Desktop
Bobby Borisov

Bobby Borisov

Bobby, an editor-in-chief at Linuxiac, is a Linux professional with over 20 years of experience. With a strong focus on Linux and open-source software, he has worked as a Senior Linux System Administrator, Software Developer, and DevOps Engineer for small and large multinational companies.