How to Migrate from CentOS 8 to Rocky Linux 8

2021-08-24 By Simon 825 Views linux centos rockylinux
0 reviews

Rocky Linux is a community enterprise operating system that is designed to be 100% bug-for-bug compatible with RHEL now that its downstream partner has changed direction.


Migration_CentOS_RockyLinux


Update the current distro packages

You need to upgrade the current CentOS 8 package to the latest version by running the commands provided here.

# dnf update -y && dnf upgrade -y

1_distro_packages


Then remove the distro related repos and settings

You must remove all CentOS gpg keys, repositories and branding details. You can remove all these by using the following command:

# rpm -e --nodeps centos-gpg-keys centos-linux-release centos-linux-repos

2_distro_repos_settings


Add a new repo file for the rocky-release

Once all the unwanted details are removed, install the Rocky Linux release package by running the following commands:


# cat << EOF > /etc/yum.repos.d/rocky.repo

[rocky]
name=Rocky linux 8
baseurl=https://download.rockylinux.org/pub/rocky/8/BaseOS/\$arch/os/
enabled=1
gpgcheck=0
EOF

3_new_repo_file


# dnf install rocky-release -y

4_install_rocky_release


Sync the current distro with the latest Rocky Linux

Next, run the following command to migrate from CentOS 8 to Rocky Linux 8 using the following command:

# dnf distro-sync -y

5_sync_distro


Verify the Distro after reboot

Reboot the Server

Please reboot if the distro updates successfully.

# reboot

6_reboot


After the reboot, you can verify your operating system version by using the following command:

# cat /etc/rocky-release

7_system_version


With deploy script

Update the packages

First, update all the packages to the latest version with the following command:

# dnf update -y

8_update_packages


Reboot the server

Once all the packages are updated, restart your system to apply the changes:

# reboot

9_reboot


After the system reboot, download the Rocky Linux migration script by using the following command:

# wget https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh

10_download_script


Make Script Executable

Change the permission of the downloaded script, so that we can execute it on our Linux operating system.

# chmod +x migrate2rocky.sh

11_script_executable


Start the CentOS migration to Rocky Linux script

We can begin the conversion process once we obtain the script, may also use the script with three other settings, as seen below and run the second command to start the conversion.

migrate2rocky.sh [OPTIONS]

Options:
-h  # --> Display this help
-r  # --> Convert to Rocky
-V  # --> Verify switch

12_start_migration


# bash migrate2rocky.sh -r

13_start_migration


The script will convert CentOS 8 Linux repositories, GPG keys, logo, and other items to Rocky Linux automatically.

Depending on the size of your current system, this could take some time.


When the migration is finished, you will receive:

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

14_migration_complete


Then sync and reboot:

# dnf distro-sync -y

15_sync_reboot

# reboot

16_reboot


After the reboot, you can verify your operating system version using the following command:

# cat /etc/os-release


You have something like the below:

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

17_final_release


Related Tutorial

What do you think about this article?

Rate this article
LayerStack Plans

Try this guide to receive free bundled services at signup on a new free account.

Sign Up

Your Feedback Is Important

We hope you’ll give the new products and updates a try. If you have an idea for improving our products or want to vote on other user ideas so they get prioritized, please submit your feedback on our Community platform. And if you have any questions, please feel free to ask in the Community or contact our Technical Support team.