After RedHat shifted its focus from CentOS 8 to CentOS Stream 8, Mr.Gregory Kurtzer, the original founder of CentOS, has started to develop another rebuild of RHEL, named Rocky Linux. Rocky Linux is a community enterprise operating system designed to be 100% compatible with RedHat Enterprise Linux. This step by step guide explains how to migrate to Rocky Linux 8 from CentOS 8 Linux using migrate2rocky script. Rocky Linux dev team has created migrate2rocky script to easily convert an existing CentOS 8 system to Rocky Linux 8.
Migrate to Rocky Linux 8 from CentOS 8 using migrate2rocky script
A word of caution:
First of all, backup important data from your CentOS system before starting upgrade process. I tested this script in a freshly installed CentOS 8 virtual machine. My VM doesn't has any data and it is a server edition with minimal installation. It worked just fine without any issues as expected.
Let us now start Rocky Linux migration task!
Step 1: Upgrade the current CentOS 8 Linux system to latest available version:
$ sudo dnf --refresh upgrade
After update is completed, Reboot your system:
$ sudo reboot
Step 2: Check if you're running the CentOS 8 version on your system:
$ cat /etc/redhat-release
CentOS Linux release 8.4.2105
You can also use the following command to display detailed output:
$ cat /etc/os-release
NAME="CentOS Linux" VERSION="8" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8"
Step 3: Download Rocky Linux migration script named migrate2rocky from here.
$ curl -O https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh
Step 4: Make the
migrate2rocky script executable:
$ sudo chmod +x migrate2rocky.sh
Step 5: Finally, run
migrate2rocky script with
-r switch to migrate to Rocky Linux 8 from CentOS 8 Linux system using command:
$ sudo bash migrate2rocky.sh -r
This will replace CentOS 8 repositories with Rocky Linux repositories, remove CentOS branding, add Rocky Linux GPG keys, and then download, install and upgrade all packages.
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 Getting system package names for CentOS Linux 8....... Found the following system packages which map from CentOS Linux 8 to Rocky Linux 8: CentOS Linux 8 Rocky Linux 8 centos-backgrounds rocky-backgrounds centos-gpg-keys rocky-gpg-keys centos-logos rocky-logos centos-indexhtml rocky-indexhtml centos-linux-release rocky-release centos-linux-repos rocky-repos [...]
This will take a few minutes to hours depending upon the Internet speed and the installation size. If your installation is minimal and you have SSD with fast Internet connection, it will probably take 5-10 minutes.
Upon successful Rocky Linux migration, you should see the following output:
[...] Complete! Done, please reboot your system. A log of this installation can be found at /var/log/migrate2rocky.log
Step 6: Run the following command to synchronize installed packages to the latest available versions.
$ sudo dnf distro-sync -y
Finally, reboot your system:
$ sudo reboot
Step 7: Login to the Rocky Linux system and update the hostname and username that matches to Rocky Linux:
$ sudo hostnamectl set-hostname rocky8
Log out and log back in to apply the changes.
Check the hostname to verify it has been changed:
$ hostname rocky8
Yes, it has been updated!
Here is my Rocky Linux 8.4 system running in KVM after successfully migrated from CentOS 8.4.
That's it. We have successfully migrated CentOS Linux 8 to Rocky Linux 8 using
Rocky Linux 8.4 enterprise Linux operating system is now ready to use.
Migrate CentOS 7 to Any Enterprise Linux 8 With ELevate
Please note that the Migrate2rocky script will only convert CentOS 8 version to Rocky Linux 8. If you are running older versions like CentOS 7.x or 6.x, this script will not help.
Thankfully, there is a tool called ELevate to migrate CentOS 7 to any Enterprise Linux 8.x version.
ELevate is an open source migration tool that allows you to migrate between major versions of RHEL-based distributions from 7.x to 8.x version. For more details, refer the following guide.
- How To Migrate CentOS 7 To AlmaLinux 8, CentOS Stream 8, Oracle Linux 8, Rocky Linux 8 Using ELevate Utility
Install Rocky Linux
You can download the latest Rocky Linux version from the following link. As of writing this guide, Rocky Linux 8 is available for x86_64 bit and ARM64 (aarch64) architectures. Currently, Rocky Linux minimal ISO, DVD, torrent files are available for download in the official download page.
Rocky Linux container images are available in the following links:
Download the images of your choice and install Rocky Linux on your system as described in the following link.