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.
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
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
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
# dnf install rocky-release -y
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
Verify the Distro after reboot
Reboot the Server
Please reboot if the distro updates successfully.
# reboot
After the reboot, you can verify your operating system version by using the following command:
# cat /etc/rocky-release
With deploy script
Update the packages
First, update all the packages to the latest version with the following command:
# dnf update -y
Reboot the server
Once all the packages are updated, restart your system to apply the changes:
# 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
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
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
# bash migrate2rocky.sh -r
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
Then sync and reboot:
# dnf distro-sync -y
# 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"
Related Tutorials