How to Upgrade CentOS 7 to Rocky Linux 8
Yes, you have read it right. You will now be able to upgrade CentOS 7 to Rocky Linux 8. Since CentOS 8 is dead, there is no point migrating CentOS 7 to CentOS 8.
Now, not only you can upgrade CentOS 7 to Rocky Linux 8, but you can also upgrade CentOS 7 to other EL 8 derivatives such as AlmaLinux, CentOS Stream, Oracle, and Rocky Linux.
Thanks to the ELevate, an initiative and a tool that enables migration between major versions of RHEL derivatives.
Here, we will see how to upgrade CentOS 7 to Rocky Linux 8.
Take System Backup
Before you proceed, I highly recommend you take a system backup or snapshots for recovery in case of issues after the upgrade. In addition to this, you may try this upgrade procedure on a virtual machine or test machine before performing it on a live server.
Upgrade CentOS 7 to Rocky Linux 8
Update CentOS 7
First, bring up your system to the latest release of CentOS 7 (7.9.2009).
yum update -y
Then, reboot the system to complete the update.
Check the OS release post the reboot.
CentOS Linux release 7.9.2009 (Core)
First, install the Elevate release package to configure the project repo and install the GPG key.
yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm
Then, install the leapp packages and migration data for Rocky Linux.
yum install -y leapp-upgrade leapp-data-rocky
Initiate the pre-upgrade check with the below command. This check will determine the possibility of an OS upgrade and report potential problems you will need to fix before upgrading.
NOTE: No packages will be installed at the pre-upgrade check phase.
In the end, you will get a summary report with potential issues something like below.
. . . . . . ============================================================ UPGRADE INHIBITED ============================================================ Upgrade has been inhibited due to the following problems: 1. Inhibitor: Detected loaded kernel drivers which have been removed in RHEL 8. Upgrade cannot proceed. 2. Inhibitor: Possible problems with remote login using root account 3. Inhibitor: Missing required answers in the answer file Consult the pre-upgrade report for details and possible remediation. ============================================================ UPGRADE INHIBITED ============================================================ Debug output written to /var/log/leapp/leapp-preupgrade.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
In addition, you can get more information about the reported upgrade blockers (Risk Factor: high (inhibitor) and recommended solutions in the /var/log/leapp/leapp-report.txt file. Apart from the blockers, the file will also contain other RISKs ranging from info to high, which you can review and proceed further.
For the above three problems (you will get by default), run the below commands to fix them and proceed with the upgrade.
rmmod pata_acpi echo PermitRootLogin yes | tee -a /etc/ssh/sshd_config leapp answer --section remove_pam_pkcs11_module_check.confirm=True
Upgrade to Rocky Linux 8
Now, start an upgrade with the below command. This upgrade will take some time to complete.
. . . . . . The downloaded packages were saved in cache until the next successful transaction. You can remove cached packages by executing 'dnf clean packages'. ==> Processing phase `InterimPreparation` ====> * efi_interim_fix Adjust EFI boot entry for first reboot ====> * upgrade_initramfs_generator Creates the upgrade initramfs ====> * 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 successful upgrade, reboot the system.
The system will now boot into the ELevate-Upgrade-Initramfs kernel and continue the upgrade. If you want, you can also take the server console and monitor the upgrade.
Post Migration Checkouts
After the migration is completed, verify the current OS version.
Rocky Linux release 8.4 (Green Obsidian)
Also, check if the server still has the remains of CentOS and EL 7 packages.
rpm -qa | grep centos rpm -qf | grep el7