CentOS 7 has reached its End of Life as of June 30, 2024. This is to mean no more updates, security fixes and bug patches for different applications bundled into CentOS 7 repositories. The danger of running CentOS 7 in production with it reaching end-of-life could be a security threat and make your system vulnerable to attacks. So, is there a way out? In this article we explore migrating from CentOS 7 to AlmaLinux 8.
AlmaLinux is an enterprise Linux operating system build from RHEL source code by the AlmaLinux OS Foundation. It is binary-compatible with Red Hat Enterprise Linux making it an ideal substitute to the dying CentOS Linux. In this post we share the necessary steps to move your current system on CentOS 7 to AlmaLinux 8 which is currently under active support and follows the open source OS model.
How to get started?
If you are actively using CentOS 7, you must have noticed its repositories stopped working. Fortunately, you can still activate Vault repositories to update your system. Refer to our article below on how to go about this Enable CentOS 7 Vault repositories.
But for simplicity, we can use CentOS 7 mirror provided by AlmaLinux for use with ELevate:
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://el7.repo.almalinux.org/centos/CentOS-Base.repo
After fixing the CentOS 7 repositories issue, apply any available updates before you switch over to AlmaLinux.
sudo yum -y update
For successful updates, system reboot maybe necessary.
sudo reboot
Delete any CentOS base repositories configured after upgrade.
rm -rf /etc/yum.repos.d/CentOS-*
Backup your CentOS 7 system
Backup is a proven practice to avoid data loss. Use backup solutions available at your disposal to perform a system backup. In virtualized environments, a snapshot of the Virtual Machine can be taken before OS upgrade to AlmaLinux.
Some of the helpful tools in system backup include:
You can try different tools to help you select one suitable to your needs.
Download AlmaLinux Elevate tools
Taking advantage of existing migration tools is more efficient than trying to write your own scripts which will be time consuming and error-prone. Why re-invent if something exist? The wonderful team from AlmaLinux created AlmaLinux ELevate tool, This script uses AlmaLinux ELevate tool, which is based on the leapp modernization framework which is based on the leapp modernization framework.
The ELevate too will support the following 3rd party repositories during migration process:
- EPEL
- PostgreSQL
- Imunify
- KernelCare
- MariaDB
- nginx
Install elevate-release
package which contains the GPG key and project repository:
sudo yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el$(rpm --eval %rhel).noarch.rpm
Once the repository is configured, download leapp packages required for upgrade.
sudo yum install -y leapp-upgrade leapp-data-almalinux
Before doing an actual OS migration, it is critical to do preupgrade
check. The Leapp utility will create /var/log/leapp/leapp-report.txt file containing possible problems and recommended solutions.
sudo leapp preupgrade
Make sure you review generated report and fix any issues before attempting a migration, especially if you have applications installed from third party repositories, or working on a highly customized CentOS 7 Linux system.
cat /var/log/leapp/leapp-report.txt
The following are the most common fixes from the /var/log/leapp/leapp-report.txt file.
sudo rmmod pata_acpi
echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config
sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True
Review the whole file and check the ELevate Frequent Issues page for known and frequent issues and guidance steps to solve them.
Upgrade from CentOS 7 to AlmaLinux 8
Initiate the upgrade by executing the leapp upgrade
command:
sudo leapp upgrade
Wait for the upgrade process to complete. Leapp will add a new entry in GRUB called ELevate-Upgrade-Initramfs
.
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Complete!
====> * add_upgrade_boot_entry
Add new boot entry for Leapp provided initramfs.
A reboot is required to continue. Please reboot your system.
Debug output written to /var/log/leapp/leapp-upgrade.log
============================================================
REPORT
============================================================
A report has been generated at /var/log/leapp/leapp-report.json
A report has been generated at /var/log/leapp/leapp-report.txt
============================================================
END OF REPORT
============================================================
Answerfile has been generated at /var/log/leapp/answerfile
After the upgrade is completed reboot the system to use new OS.
sudo reboot
After the system is rebooted, login and verify your current OS version.
cat /etc/redhat-release
cat /etc/os-release
Remember to check logs and packages leftovers from previous OS version, it’s highly recommended to remove or update them manually.
rpm -qa | grep el7
Review the reports for more details on packages.
cat /var/log/leapp/leapp-report.txt
cat /var/log/leapp/leapp-upgrade.log
Great article, but i also needed to remove kernel module floppy using “sudo rmmod floppy” for “leapp preupgrade” to work.