migrating from CentOS 8 to RockyLinux or AlmaLinux

The end of support for CentOS 8 and the transition to a continuous updates model in CentOS Stream forced enterprise customers to look for alternative solutions. We have written a step-by-step guide for switching to RockyLinux or AlmaLinux – popular free distributions that are binary compatible with RedHat Enterprise Linux (RHEL).

Systems with a short life cycle or rolling release models are not suitable for creating a developed corporate infrastructure: too many things can go wrong in them after the next update. In addition to CentOS, there are other Linux distributions with long-term support (for example, Ubuntu Server LTS), but migrating to them will require serious work. If you have a lot of physical and virtual machines, it is better to choose a solution that is binary compatible with RHEL, so that the transition from CentOS 8 is simple and painless.

We settled on the free AlmaLinux and RockyLinux server distributions: the first one was created by the company CloudLinux, and the second is being developed by CentOS creator Gregory Kurtzer along with the developer community. They plan to support them for 10 years, i.е. the entire development cycle of the original RHEL 8.

Full binary compatibility means that applications installed on CentOS 8 or RHEL 8 will continue to work on AlmaLinux and Rocky Linux without changes – this is a great alternative if you do not want to pay for RedHat support, which, recall, includes receiving binary updates (for free only original texts are distributed). Below is the migration option used in the company HOSTKEY.

Step 1: Back up

Before starting the migration, it is better to back up the entire server or at least important directories. In well-established infrastructures, the process is automated (there are Backup & Deploy workflows), but when migrating to another distribution, you should be extremely careful.

Step 2: Verify that the versions match

Before running the migration script, you should check the version of CentOS, which must be at least 8.3. Otherwise, you will have to specify the addresses of mirrors with packages for updating and run the dnf update -y command (CentOS images can be downloaded from link). The system will be updated to version CentOS Linux release 8.5.2111.

Otherwise, an error will occur:

Step 3Add mirrors if your system is older than CentOS 8.3

If you haven’t updated your OS for a long time, you need to add archive mirrors for CentOS 8 using the following commands:

AlmaLinux:

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-*

Rocky Linux:

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 migration script

AlmaLinux:

cd /tmp
curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

Rocky Linux:

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

Step 5Give the script the right to execute (execute)

AlmaLinux:

chmod +x almalinux-deploy.sh 

Rocky Linux:

chmod +x migrate2rocky.sh

Step 6Run the script to download and install the packages

AlmaLinux:

sudo bash almalinux-deploy.sh

Rocky Linux:

sudo bash migrate2rocky.sh -r 

Below is an example of a pre-migration check. There are no problems with package dependencies and operating system version:

Step 7: Complete the installation and restart your computer

If the installation is successful, the following message will appear:

AlmaLinux:

Rocky Linux:

After the installation is complete, reboot the system with the reboot command. In case of a successful migration, the new distribution will be listed at the stage of system boot and kernel selection.

AlmaLinux:

Rocky Linux:

Step 8: Check for 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 #позволяет проверить переход на AlmaLinux и RockyLinux
dmesg #проверка аппаратных ошибок
journalctl #ошибки в системе

Step 9: Check the Services

After the migration is completed, it is worth checking the correct operation of all configured services and installed application software. Usually there are no failures, but there may be exceptions.

Step 10Additional Steps for Rocky Linux

If you’re migrating a GUI system, you might have problems migrating from CentOS to Rocky Linux (the Alma script is more reliable). During the execution of the script, there may be problems installing packages, and old CentOS packages will be corrupted.

You need to check the system version with the following commands:

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

If an error occurs, a message will be displayed:

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

You will receive a similar message when you try to run the command:

dnf makecache & dnf update

A partial rollback of the CentOS system with the installation of packages from the archive mirror will help to solve the problem. vault. You need to download the packages of the distribution version you have installed (see below). Step 2). In our case, CentOS version 8.5.2111 was used.

Run the following 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

Install all dependencies before running the migration script. We received a list of 6 problematic 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

I had to install 3 packages:

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

After following these steps to resolve dependency issues, you must repeat the procedure, starting with Step 6.

findings

The process of migration from CentOS 8 to AlmaLinux does not require a significant investment of time, and also allows you to get a stable OS without infrastructure changes. When switching to Rocky Linux, there may be easily resolvable problems. Both clone distributions are based on the free RHEL 8 source, and the only difference between them is support. The presence of an AlmaLinux corporate developer may alert a part of the community, despite the assurances of CloudLinux representatives in the independence of the project.

_______

By the way, at hosting your servers in Moscow data centers or Western Europe, we at HOSTKEY will always help with seamless migration, relocation and any necessary maintenance. For example, in the Netherlands you can rent racks along with a full range of services to support your IT infrastructure. Even from Russia, after all our specialists will do everything themselves. And pay for services still possible in rubles.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *