How to migrate from Centos 8 to Rocky Linux 8

Rocky Linux is a Linux distribution that is intended to be a downstream, complete binary-compatible release using the Red Hat Enterprise Linux operating system source code. The project’s aim is to provide a community-supported, production-grade enterprise operating system.

The Rocky linux team provides migrate2rocky. It’s a script that, when executed, will change out all of your repositories to those of Rocky Linux. Packages will be installed and upgraded/downgraded as necessary, and all of your OS’ branding will change too.

In this guide we will learn how to migrate CentOS 8 Linux live server to Rocky Linux 8 using a shell script provided by the Rocky Linux project.

Table of Content

  1. Ensure your system is up to date
  2. Backup your CentOS 8 system

1. Ensure your system is up to date

Ensure that the server is updated using this command:

sudo dnf update -y

Let us also verify CentOS Linux 8 version using this command:

$ 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"

2. Backup your CentOS 8 system

It is a good practice to ensure periodic updates on your system. If you have application data in the system ensure that it is backed up. Please also make OS snapshot to revert back when something goes wrong. Always keep verified backups.

3. Install git client

We will need git to clone the scripts necessary to perform the migration. Install git client using this command:

sudo dnf install -y git

4. Clone the repo to install migration tool

The Rocky linux team provides migrate2rocky. It’s a script that, when executed, will change out all of your repositories to those of Rocky Linux. Let us switch to the /tmp directory then clone the repo using this command:
cd /tmp/
git clone https://github.com/rocky-linux/rocky-tools.git

5. Execute the script to migrate to Rocky Linux

Once the repo is cloned, we need to execute the migrate2rocky.sh to migrate to rocky linux. The script will

change out all of your repositories to those of Rocky Linux. Packages will be installed and upgraded/downgraded as necessary, and all of your OS’ branding will change too.

Change to the directory where the script is located:

cd /tmp/rocky-tools/migrate2rocky

Then make the script executable

chmod -v +x migrate2rocky.sh

Finally, execute the script to initiate the migration process

sudo ./migrate2rocky.sh -r

Wait for the process to finish, this can take some time. Once done you should see a message similar to this:

Complete!

Done, please reboot your system.
A log of this installation can be found at /var/log/migrate2rocky.log

Reboot the system using this command:

sudo systemctl reboot

Verifying the migration

Once the reboot is done, login to the server and confirm that it was successful. Verify the version to make sure we are now switched to Rocky Linux using this command:

$ cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.5 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.5"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.5 (Green Obsidian)"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:rocky:rocky:8:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky Linux"
ROCKY_SUPPORT_PRODUCT_VERSION="8"

We can also check the CentOS release file

$ cat /etc/centos-release
Rocky Linux release 8.5 (Green Obsidian)

Checking the hostname with hostnamectl will also reveal the info

$ hostnamectl
   Static hostname: dev-ce8-0-srv.citizix.com
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 4d78db4a684b6f64404255df88b2c437
           Boot ID: ae1e300871314a1eae3e2dd5ae5e9e83
    Virtualization: kvm
  Operating System: Rocky Linux 8.5 (Green Obsidian)
       CPE OS Name: cpe:/o:rocky:rocky:8:GA
            Kernel: Linux 4.18.0-348.7.1.el8_5.x86_64
      Architecture: x86-64
comments powered by Disqus
Citizix Ltd
Built with Hugo
Theme Stack designed by Jimmy