• Migrate CentOS 8 to AlmaLinux 8

Migrate CentOS 8 to AlmaLinux 8

After the release of CentOS 8 we assumed the usual 10-year lilfecycle like it is common in the RHEL world. Bugfixes and feature backports from newer versions in the early years of that period and plain security fixes towards the end of the distribution's lifetime are commonly provided. After RedHat had been acquired by IBM the work on CentOS 8 had been stopped early (2021-12-31) and the focus shifted to CentOS Stream, a kind of preview for the next RHEL point release. As CentOS Stream is somewhat ahead, software versions may differ and lead to compatibility problems. In order to restore a bug-to-bug compatible system, we describe the migration from CentOS 8 to AlmaLinux 8.

We have migrated a couple of (virtual) servers from CentOS 8 to AlmaLinux 8 using this howto. Nevertheless we advise you to be careful and create a backup or snapshot. Use the following instructions at your own risk.


Update to CentOS 8.5

You can skip this step if you're already running CentOS 8.5 including the latest updates. This example shows how to update to the latest release, which does not work out-of-the-box as the mirror servers providing the necessary rpm packages are not online anymore. Therefore we change the repository URLs to use the CentOS archive vault.centos.org and update the system afterwards.

Startingpoint in this example is CentOS 8.0.1905:

[root@server ~]# cat /etc/centos-release
CentOS Linux release 8.0.1905 (Core) 

Update repository URLs:

[root@server ~]# sed -i -r 's|^(mirrorlist.+)$|#\1|g; s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever/|baseurl=https://vault.centos.org/8.5.2111/|g' /etc/yum.repos.d/CentOS-*.repo 

[root@server ~]# dnf clean all
61 files removed

[root@server ~]# dnf update
CentOS-8 - AppStream                                                                  7.2 MB/s | 8.4 MB     00:01    
CentOS-8 - Base                                                                        38 MB/s | 4.6 MB     00:00    
CentOS-8 - Extras                                                                     129 kB/s |  10 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                                        8.0 MB/s |  14 MB     00:01    
Last metadata expiration check: 0:00:01 ago on Wed 03 Jul 2024 04:10:48 PM CEST.
Dependencies resolved.
==================================================================================================================
 Package                                                    Arch      Version                 Repository     Size
==================================================================================================================
Installing:
 centos-linux-release                                       noarch    8.5-1.2111.el8          BaseOS         22 k
     replacing  centos-release.x86_64 8.0-0.1905.0.9.el8
 kernel                                                     x86_64    4.18.0-348.7.1.el8_5    BaseOS        7.0 M
 kernel-core                                                x86_64    4.18.0-348.7.1.el8_5    BaseOS         38 M
 kernel-modules                                             x86_64    4.18.0-348.7.1.el8_5    BaseOS         30 M
Upgrading:
 annobin                                                    x86_64    9.72-1.el8_5.2          AppStream     111 k
 apr                                                        x86_64    1.6.3-12.el8            AppStream     129 k
 bind-libs                                                  x86_64    32:9.11.26-6.el8        AppStream     174 k
 bind-libs-lite                                             x86_64    32:9.11.26-6.el8        AppStream     1.2 M
 bind-license                                               noarch    32:9.11.26-6.el8        AppStream     102 k
 bind-utils                                                 x86_64    32:9.11.26-6.el8        AppStream     451 k
 ...
 
Transaction Summary
==================================================================================================================
Install   28 Packages
Upgrade  391 Packages

Total download size: 504 M
Is this ok [y/N]: y
Downloading Packages:
...
Complete!

Migrate CentOS 8.5 to AlmaLinux 8

The first step is to change the repository URLs (again), then import the AlmaLinux RPM-GKG-Key to verify rpm packages and starting the migration using almalinux-deploy.sh afterwards. This script is provided by AlmaLinux via GitHub.


[root@server ~]# 
sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[baseos\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/BaseOS/$basearch/os' /etc/yum.repos.d/CentOS-Linux-BaseOS.repo
sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[appstream\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/AppStream/$basearch/os' /etc/yum.repos.d/CentOS-Linux-AppStream.repo
sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[cr\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/ContinuousRelease/$basearch/os' /etc/yum.repos.d/CentOS-Linux-ContinuousRelease.repo
sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[devel\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/Devel/$basearch/os' /etc/yum.repos.d/CentOS-Linux-Devel.repo
sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[extras\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/extras/$basearch/os' /etc/yum.repos.d/CentOS-Linux-Extras.repo
sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[fasttrack\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/fasttrack/$basearch/os' /etc/yum.repos.d/CentOS-Linux-FastTrack.repo
sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[ha\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/HighAvailability/$basearch/os' /etc/yum.repos.d/CentOS-Linux-HighAvailability.repo
sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[plus\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/centosplus/$basearch/os' /etc/yum.repos.d/CentOS-Linux-Plus.repo
sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[powertools\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/PowerTools/$basearch/os' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo

[root@server ~]# dnf clean all
30 files removed

[root@server ~]# rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux

[root@server ~]# curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

[root@server ~]# bash almalinux-deploy.sh
Check root privileges                                                 OK
Check centos-8.x86_64 is supported                                    OK
Download RPM-GPG-KEY-AlmaLinux                                        OK
Import RPM-GPG-KEY-AlmaLinux to RPM DB                                OK
Download almalinux-release package                                    OK
Verify almalinux-release package                                      OK
Your OS is supported                                                  OK
warning: /etc/yum.repos.d/CentOS-Linux-PowerTools.repo saved as /etc/yum.repos.d/CentOS-Linux-PowerTools.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-Linux-Plus.repo saved as /etc/yum.repos.d/CentOS-Linux-Plus.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-Linux-HighAvailability.repo saved as /etc/yum.repos.d/CentOS-Linux-HighAvailability.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-Linux-FastTrack.repo saved as /etc/yum.repos.d/CentOS-Linux-FastTrack.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-Linux-Extras.repo saved as /etc/yum.repos.d/CentOS-Linux-Extras.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-Linux-Devel.repo saved as /etc/yum.repos.d/CentOS-Linux-Devel.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-Linux-ContinuousRelease.repo saved as /etc/yum.repos.d/CentOS-Linux-ContinuousRelease.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-Linux-BaseOS.repo saved as /etc/yum.repos.d/CentOS-Linux-BaseOS.repo.rpmsave
warning: /etc/yum.repos.d/CentOS-Linux-AppStream.repo saved as /etc/yum.repos.d/CentOS-Linux-AppStream.repo.rpmsave
Remove OS specific rpm packages                                       OK
Verifying...                          ########################################
Preparing...                          ########################################
Updating / installing...
almalinux-release-8.10-1.el8          ########################################
Install almalinux-release package                                     OK
Remove centos-logos-httpd packages                                    OK
Install almalinux-logos-httpd packages                                OK
Backup of alternatives is done                                        OK
Last metadata expiration check: 0:00:13 ago on Wed 03 Jul 2024 04:45:55 PM CEST.

NetworkManager.x86_64                    1:1.40.16-15.el8_9                        baseos   
NetworkManager-libnm.x86_64              1:1.40.16-15.el8_9                        baseos   
NetworkManager-team.x86_64               1:1.40.16-15.el8_9                        baseos   
NetworkManager-tui.x86_64                1:1.40.16-15.el8_9                        baseos   
acl.x86_64                               2.2.53-3.el8                              baseos   
...
Complete!
Run dnf distro-sync -y                                                OK
Restoring of alternatives is done                                     OK
Generating grub configuration file ...
done
All Secure Boot related packages which were not released by AlmaLinux are reinstalledOK

Migration to AlmaLinux is completed

After almalinux-deploy.sh has successfully completed the migration, you should reboot the server. You can also verify that the new kernel for AlmaLinux 8.10 in this case is the new grub default:

[root@server ~]# grubby --info DEFAULT | grep AlmaLinux
title="AlmaLinux (4.18.0-553.8.1.el8_10.x86_64) 8.10 (Cerulean Leopard)"

[root@server]# cat /etc/almalinux-release
AlmaLinux release 8.10 (Cerulean Leopard)
Data protection info | Help us to optimize this site and allow cookies please - insights will not be passed on to third parties.
Decline Accept