The steps are taken from this page https://wiki.almalinux.org/elevate/ELevating-CentOS7-to-AlmaLinux-9.html
To upgrade to AlmaLinux 9, you will need to migrate to AlmaLinux 8 first.
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://el7.repo.almalinux.org/centos/CentOS-Base.repo
sudo yum upgrade -y
Once yum finishes, reboot
sudo reboot
Now install elevate-release and leapp packages
sudo yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el$(rpm --eval %rhel).noarch.rpm
sudo yum install -y leapp-upgrade leapp-data-almalinux
Let’s run a pre upgrade check to see if there are any errors.
sudo leapp preupgrade
If everything checked out ok, proceed with the upgrade.
sudo leapp upgrade
Once finished, reboot.
sudo reboot
Once the system is booted, verify it upgraded.
cat /etc/*release
Problems
https://wiki.almalinux.org/elevate/ELevate-frequent-issues
LUKS
If you are using LUKS and encounter an error, check out the following link.
https://www.it-hure.de/2024/02/update-alma-rhel-with-leapp-and-luks/
You can disable the check with the following command.
rm -rf /usr/share/leapp-repository/repositories/system_upgrade/common/actors/inhibitwhenluks
More space needed on / filesystem
Try setting LEAPP_OVL_SIZE to 4096
export LEAPP_OVL_SIZE=4096
Then launch the upgrade with
sudo --preserve-env leapp upgrade
You can also try removing files to create more free space.
https://github.com/oamg/leapp/issues/778
Upgrading to 8.8 (Or 8.4)
For the same reason, we recommend upgrading your CentOS 7 machine to AlmaLinux OS version 8.8. To do so, you need to navigate to the /etc/leapp/files/ directory and edit the leapp_upgrade_repositories.repo to lower the AlmaLinux version in
baseurl/mirror
to 8.8.
The 8.8 repositories are archived. To upgrade to AlmaLinux 8.8, change ‘/etc/leapp/leapp_upgrade_repositories.repo” to the following.
[almalinux8-BaseOS]
name=AlmaLinux 8 - BaseOS
baseurl=https://vault.almalinux.org/8.8/BaseOS/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
[almalinux8-AppStream]
name=AlmaLinux 8 - AppStream
baseurl=https://vault.almalinux.org/8.8/AppStream/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
[almalinux8-PowerTools]
name=AlmaLinux 8 - PowerTools
baseurl=https://vault.almalinux.org/8.8/PowerTools/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
[almalinux8-HighAvailability]
name=AlmaLinux 8 - HighAvailability
baseurl=https://vault.almalinux.org/8.8/HighAvailability/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
[almalinux8-ResilientStorage]
name=AlmaLinux 8 - ResilientStorage
baseurl=https://vault.almalinux.org/8.8/ResilientStorage/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
[almalinux8-Extras]
name=AlmaLinux 8 - Extras
baseurl=https://vault.almalinux.org/8.8/extras/$basearch/os/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-AlmaLinux
If you have issues, you may consider upgrading to 8.4 first. To do that, change 8.8 to 8.4, and comment out the ResilientStorage section.
GPG Key failing after upgrade
Try importing the AlmaLinux 8 GPG key
rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux
https://almalinux.org/blog/2023-12-20-almalinux-8-key-update