Skip to content

Step-by-step instructions for migrating from CentOS 8 to Rocky Linux

Step 1. Backup

Back up the server or important directories on the server.

Step 2: Verification of version's match

Before running the migration script, you should check the version of the operating system. CentOS must be at least 8.3. Otherwise, you need to register the addresses of mirrors with packages for updating, as indicated in the Step 3 paragraph , and run the command

dnf update -y

CentOS images can be downloaded at the link. The system will be upgraded to CentOS Linux release 8.5.2111.

Step 3. Adding mirrors

You need to add mirrors to CentOS 8 using the following commands:

sudo sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
sudo sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*

Step 4. Download the script for migration:

cd /tmp
curl -O https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh

Step 5. Grant execution rights for the script:

chmod +x migrate2rocky.sh

Step 6. Execute a script starting the downloading and installing packages:

sudo bash migrate2rocky.sh -r 

Step 7: Completion of the installation and reboot

In case of successful installation, the following message will appear:

After the installation is complete, you should reboot the system with the command reboot.

In case of successful migration, Rocky Linux will be present in the list at the system boot time and kernel selection:

Step 8. Finding errors

After rebooting the system, you need to check for errors, as well as the name and version of the system:

  • cat /etc/redhat-release – check if we have switched to RockyLinux for sure;
  • dmesg - check for hardware errors;
  • journalctl - errors in the system.

Step 9. Verification of the services' operation

If you're migrating a GUI system, you might have problems during the migration from CentOS to Rocky Linux. While executing the migration script, there may be problems with packages when the system is not migrated to RockyLinux. This will corrupt old CentOS packages. When you try to check the system version with the commands described below:

cat /etc/os-release
cat /etc/redhat-release

The following message will be displayed:

Unable to detect release version (use '--releasever' to specify release version--

A similar message will be received while trying to execute commands:

dnf makecache & dnf update

The solution of this problem is a partially rollback to the CentOS system by installing packages from the archive mirror vault.. It is necessary to download the packages of the version that was previously installed on the system (see Step 2) CentOS version 8.5.2111.

Run a sequence of commands:

cd /tmp
wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-release-8.5-1.2111.el8.noarch.rpm
wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-linux-repos-8-3.el8.noarch.rpm
wget https://vault.centos.org/centos/8/BaseOS/x86_64/os/Packages/centos-gpg-keys-8-3.el8.noarch.rpm
rpm -ivh ./centos-gpg-keys-8-3.el8.noarch.rpm  --force
rpm -ivh ./centos-linux-release-8.5-1.2111.el8.noarch.rpm ./centos-linux-repos-8-3.el8.noarch.rpm --force

Before executing the migration script, you must pre-install all dependencies. For example, a list of 6 problem packages:

Error: Check discovered 6 problem(s)
anaconda-gui-33.16.5.6-1.el8.x86_64 has missing requires of system-logos
firefox-91.4.0-1.el8_5.x86_64 has missing requires of redhat-indexhtml
gdm-1:40.0-15.el8.x86_64 has missing requires of system-logos
gnome-session-3.28.1-13.el8.x86_64 has missing requires of system-backgrounds
gnome-session-3.28.1-13.el8.x86_64 has missing requires of system-logos
plymouth-graphics-libs-0.9.4-10.20200615git1e36e30.el8.x86_64 has missing requires of system-logos

To solve this problem, you need to install 3 packages:

yum install system-logos
yum install system-backgrounds
yum install redhat-indexhtml

After following these steps to resolve problem with dependencies, you need to repeat the migration steps from the Step 6.