Post

Convert CentOS Stream 8 to AlmaLinux 8 and Upgrade to AlmaLinux 9

Convert CentOS Stream 8 to AlmaLinux 8

This article was tested on KVM virtual machine with 4 vCPU, 8 GB RAM, and 60 GB Disk.

Before Converting

1) Backup any important files

1
Copy any important files to external drive

2) Upgrade all system packages to the latest updates

1
2
sudo dnf upgrade -y
sudo dnf distro-sync

3) Reboot system

1
sudo reboot

4) Verify OS and Kernel is on the latest version of CentOS Stream 8

1
2
3
4
cat /etc/os-release
cat /etc/redhat-release
hostnamectl
uname -a

Convert Process

1) Download almalinux-deploy

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

2) Start deployment

1
sudo bash almalinux-deploy.sh

If you got error like this:

1
Use '-d or --downgrade' option to allow downgrade from CentOS Stream  ERROR

You can downgrade CentOS Stream 8 using -d or --downgrade option

1
sudo bash almalinux-deploy.sh -d

3) Reboot system

1
sudo reboot

After Convert

1) Verify OS and Kernel is using AlmaLinux 8

1
2
3
4
cat /etc/os-release
cat /etc/redhat-release
hostnamectl
uname -a

2) Disable CentOS Stream repositories if still exists

1
sudo rm -rf /etc/yum.repos.d/CentOS-*

3) Update system using AlmaLinux repositories

1
sudo dnf upgrade --refresh -y

Upgrade from AlmaLinux 8 to AlmaLinux 9

Before Upgrade

1) Make sure we have the latest update of AlmaLinux 8

1
sudo dnf upgrade --refresh -y

2) Use latest kernel available in system

1
2
3
4
5
6
sudo grubby --default-kernel
sudo grubby --info=ALL | grep ^kernel

# Get the latest kernel
sudo grubby --info="/boot/vmlinuz-4.18.0-540.el8.x86_64"
sudo grubby --set-default "/boot/vmlinuz-4.18.0-540.el8.x86_64"

3) Change NIC name to other than ethX if used

1
2
3
4
5
6
7
# 1) Get the MAC Address of NIC
ip link

# 2) Create udev rules to change NIC name based on MAC Address
cat<< EOF | sudo tee -a /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="52:54:00:ea:4a:80",ATTR{type}=="1",NAME="enp0s3"
EOF

4) Add ELevate repository

1
sudo yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el$(rpm --eval %rhel).noarch.rpm

5) Install ELevate leapp packages and migrate-data for AlmaLinux

1
sudo yum install -y leapp-upgrade leapp-data-almalinux

6) Reboot system. Make sure system booted in to the latest kernel

1
2
3
sudo reboot
hostnamectl
uname -r

Upgrade Process

1) Run preupgrade

1
sudo leapp preupgrade

2) Fix issues for upgrade if exist

1
2
3
4
sudo sed -i "s/^AllowZoneDrifting=.*/AllowZoneDrifting=no/" /etc/firewalld/firewalld.conf

sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True
sudo leapp answer --section check_vdo.no_vdo_devices=True

3) Run pre-upgrade again

1
sudo leapp preupgrade

4) Run upgrade

1
sudo leapp upgrade

5) Reboot system. Reboot process will take times because it need to install and reconfigure all the upgrades

1
sudo reboot

After Upgrade

1) Verify OS and Kernel is using AlmaLinux 9

1
2
3
4
cat /etc/os-release
cat /etc/redhat-release
hostnamectl
uname -a

2) Disable any CentOS or AlmaLinux 8 repositories if still exists

1
sudo rm -rf /etc/yum.repos.d/CentOS-*

3) Upgrade system to latest version of AlmaLinux 9

1
sudo dnf upgrade -y

References

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.