Home » Blog » How TO » How to migrate from CentOS 8 to Rocky Linux – Step by Step Guide

How to migrate from CentOS 8 to Rocky Linux – Step by Step Guide

How to migrate from CentOS 8 to Rocky Linux

In this article, we will be discussing the process of migrating a Linode VM from CentOS 8 to Rocky Linux 8. The server in question runs a simple workload which includes PHP 8.1, MariaDB server, Nginx, SELinux and firewalld.

Rocky Linux is a highly regarded open-source operating system and is seen as a strong replacement option for CentOS 8. It is a 100% binary-compatible release that uses Red Hat Enterprise Linux (RHEL). In this article, we will be using a shell script provided by the Rocky Linux project to perform the migration.

Step 1: Backup CentOS 8
Before starting the migration process, it’s important to backup your data. Although the server in question has nightly backups, a snapshot was taken just in case anything goes wrong during the upgrade process.

Step 2: Installing Updates on CentOS 8
To install updates on the CentOS 8 server, log in using the ssh command:

ssh user@ixcraft-php8-app1

Next, use the dnf command to apply all pending updates:

sudo dnf update

Finally, reboot the Linux box using the shutdown command or reboot command:

sudo reboot

Step 3: Installing Git Client on CentOS 8
Git will be required to install the migration script. To check if git is already installed on the server, execute the type command:

type -a git

If git is not installed, use the dnf utility to install it:

sudo dnf install git
type -a git

Step 4: Migrating from CentOS 8 to Rocky Linux
Clone the repo to install the migration tool called rocky-tool:


cd /tmp/
git clone https://github.com/rocky-linux/rocky-tools.git

Change the directory using cd command where rocky-tools were cloned:

cd /tmp/rocky-tools/migrate2rocky

Set up executable permissions using the chmod command:

chmod -v +x migrate2rocky.sh

Start the migration from CentOS 8 to Rocky Linux by typing the migrate2rocky.sh command:

./migrate2rocky.sh -r

Follow the on-screen instructions and wait for the migration process to finish. Once it is done, reboot the box:

sudo systemctl reboot

Step 5: Verification
Verify the version to ensure that the server has been switched to Rocky Linux:

cat /etc/rockylinux-release
cat /etc/centos-release
hostnamectl

Make sure all the processes are running:

ss -tulpn | grep :80
ss -tulpn | grep :3306

Use the egrep command to filter out PHP, MySQL and Nginx processes:

ps aux | grep -E 'php|nginx|mysql'
ps aux | grep php-fpm

Ensure that no errors were reported by the system:

dmesg
dmesg | grep -Ei 'warn|error|notice|fail'
tail -f /var/log/my_app_1/log_file
tail -f /var/log/nginx/php_log

In conclusion, it was easy to migrate from CentOS 8 Linux or Red Hat Enterprise Linux 8 to Rocky Linux 8. Do check the Rocky Linux project website and Github link for more information.

Scroll to Top