Now that CentOS 7 is scheduled to reach EOL on June 30, 2024, ProComputers has tested the migration procedure to the following alternative RHEL-based operating systems: AlmaLinux 8, Rocky Linux 8, or Oracle Linux 8.
To effectively use this documentation article, it’s essential to have a solid working knowledge of CentOS Linux. This includes familiarity with the command line, file system structure, basic file operations, and system configuration.
IMPORTANT: As with any live upgrade, it is very important to prepare well. Make sure you test in advance the upgrade procedure using a test virtual machine. Also, make sure you have backups and/or snapshots of your virtual machine before performing the actual upgrade. PROCOMPUTERS SHALL NOT BE HELD LIABLE FOR ANY LOSS, DAMAGE, OR DISRUPTION RESULTING FROM THE UPGRADE PROCESS. THIS INCLUDES, BUT IS NOT LIMITED TO, DATA LOSS, SERVICE INTERRUPTIONS, OR ANY OTHER ADVERSE EFFECTS THAT MAY ARISE.
The migration procedure uses AlmaLinux ELevate Project and is based on the ELevate Quickstart Guide. It has been adapted for the ProComputers CentOS 7 images from both Azure Marketplace or AWS Marketplace.
Before you begin, please make sure you configure your CentOS 7 virtual machine to use the vault repositories.
In case of ProComputers LVM-partitioned virtual machines, the default 16 GiB disk volume size is not enough; therefore it should be increased to 20 GiB by adding 2 more GiB to the /usr
filesystem and 2 more GiB to the /var
filesystem, as described in this LVM resize article.
Follow the steps below in order to perform the migration:
- Fully updated virtual machine is required to accomplish the migration. So, install the latest updates first, and reboot.
$ sudo yum update -y
$ sudo reboot
- Install the
elevate-release
package
$ sudo yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el$(rpm --eval %rhel).noarch.rpm
- Install the
leapp
packages and the migration data for the OS you want to migrate to. This step is different depending on which OS you choosed.
- If you would like to migrate to AlmaLinux 8, run the following command:
$ sudo yum install -y leapp-upgrade leapp-data-almalinux
- If you would like to migrate to Rocky Linux 8, run the following command:
$ sudo yum install -y leapp-upgrade leapp-data-rocky
- If you would like to migrate to Oracle Linux 8, run the following command:
$ sudo yum install -y leapp-upgrade leapp-data-oraclelinux
- Start the pre-upgrade check.
IMPORTANT: This step will always fail, as the default CentOS 7 image doesn’t meet all requirements for migration. The pre-upgrade check will create a /var/log/leapp/leapp-report.txt
file that proposes the required remediation steps to be performed before and/or after the upgrade itself, in order to fix the issues.
$ sudo leapp preupgrade
[...]
============================================================
UPGRADE INHIBITED
============================================================
Upgrade has been inhibited due to the following problems:
1. 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
- Examine the report in the
/var/log/leapp/leapp-report.txt
file and manually resolve all the reported problems. Some reported problems contain remediation suggestions. Inhibitor problems prevent you from upgrading until you have resolved them.
In case of ProComputers packaged CentOS 7 images, the following fixes from the /var/log/leapp/leapp-report.txt
must be performed at this step:
- Missing required answers in the answer file
Risk Factor: high (inhibitor)
Title: Missing required answers in the answer file
Summary: One or more sections in answerfile are missing user choices: remove_pam_pkcs11_module_check.confirm
For more information consult https://leapp.readthedocs.io/en/latest/dialogs.html
Remediation: [hint] Please register user choices with leapp answer cli command or by manually editing the answerfile.
[command] leapp answer --section remove_pam_pkcs11_module_check.confirm=True
Run the proposed remediation command, then check the /var/log/leapp/answerfile
that should look like below:
$ sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True
$ sudo cat /var/log/leapp/answerfile
[remove_pam_pkcs11_module_check]
confirm = True
- Start the upgrade itself, then reboot when it is finalized. The process should take 5-10 minutes, depending on how powerful is your virtual machine.
$ sudo leapp upgrade
[...]
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
$ sudo reboot
- After the reboot, the virtual machine automatically boots into a
ELevate-Upgrade-Initramfs
GRUB menu, and will continue the upgrade process from there. It is highly recommended to monitor this process from the console. This is the longest step and should take another 10-15 minutes, depending on how powerful is your your virtual machine. The process is finalized when you see on the console the following:
[ 21.726471] leapp3[972]: Debug output written to /var/log/leapp/leapp-upgrade.log
[ 21.726858] leapp3[972]: ============================================================
[ 21.726925] leapp3[972]: REPORT
[ 21.726969] leapp3[972]: ============================================================
[ 21.727034] leapp3[972]: A report has been generated at /var/log/leapp/leapp-report.json
[ 21.727078] leapp3[972]: A report has been generated at /var/log/leapp/leapp-report.txt
[ 21.727123] leapp3[972]: ============================================================
[ 21.727164] leapp3[972]: END OF REPORT
[ 21.727207] leapp3[972]: ============================================================
[ 21.727250] leapp3[972]: Answerfile has been generated at /var/log/leapp/answerfile
[ OK ] Started Temporary Leapp service which resumes execution after reboot
- After reboot, login to the system and check how the migration went. The login username remains the same with the one before the upgrade. Verify that the current OS is the one you need. Below is an example for AlmaLinux 8.
NOTE: For the first command below, in Rocky Linux, you should use /etc/rocky-release
and for Oracle Linux, you should user /etc/oracle-release
.
$ cat /etc/almalinux-release
AlmaLinux release 8.10 (Cerulean Leopard)
$ cat /etc/os-release
NAME="AlmaLinux"
VERSION="8.10 (Cerulean Leopard)"
ID="almalinux"
ID_LIKE="rhel centos fedora"
VERSION_ID="8.10"
PLATFORM_ID="platform:el8"
PRETTY_NAME="AlmaLinux 8.10 (Cerulean Leopard)"
ANSI_COLOR="0;34"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:almalinux:almalinux:8::baseos"
HOME_URL="https://almalinux.org/"
DOCUMENTATION_URL="https://wiki.almalinux.org/"
BUG_REPORT_URL="https://bugs.almalinux.org/"
ALMALINUX_MANTISBT_PROJECT="AlmaLinux-8"
ALMALINUX_MANTISBT_PROJECT_VERSION="8.10"
REDHAT_SUPPORT_PRODUCT="AlmaLinux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.10"
SUPPORT_END=2029-06-01
$ sudo uname -r
4.18.0-553.8.1.el8_10.x86_64
Note that .el8_10
is important in the last command above.
- Check packages left from CentOS 7, and consider removing them or update manually.
- Remove weak modules from old CentOS 7 kernel versions. If you have multiple old kernels, repeat the following step for each kernel.
$ sudo ls -d /lib/modules/*.el7* | xargs -n 1 basename
$ sudo weak-modules --remove-kernel 3.10.0-1160.108.1.el7.x86_64
- Remove the old CentOS 7 kernel from the boot loader entry. Use the kernel versions listed in the previous step. If you have multiple old kernels, repeat this step for each kernel.
$ sudo kernel-install remove 3.10.0-1160.108.1.el7.x86_64 /lib/modules/3.10.0-1160.108.1.el7.x86_64/vmlinuz
- Remove old CentOS 7 kernel packages. If you have multiple old kernels, repeat the following step for each kernel.
$ sudo rpm -qa | grep kernel | grep el7
kernel-3.10.0-1160.108.1.el7.x86_64
$ sudo yum remove -y kernel-3.10.0-1160.108.1.el7.x86_64
- Remove any remaining empty directories:
$ sudo rm -r /lib/modules/*el7*
- Locate remaining CentOS 7 packages and remove them.
During the in-place upgrade, Leapp
packages that were installed with the Leapp
utility are automatically added to the exclude list to prevent critical files from being removed or updated. After the in-place upgrade, you must remove these Leapp
packages from the exclude list before they can be removed from the system.
$ sudo yum config-manager --save --setopt exclude=''
$ sudo rpm -qa | grep -e '\.el[67]'
python2-leapp-0.14.0-1.el7.noarch
leapp-data-almalinux-0.2-5.el7.noarch
libssh2-1.8.0-4.el7_9.1.x86_64
leapp-upgrade-el7toel8-0.16.0-6.el7.elevate.20.noarch
elevate-release-1.0-2.el7.noarch
leapp-0.14.0-1.el7.noarch
$ sudo yum remove -y python2-leapp-0.14.0-1.el7.noarch leapp-data-almalinux-0.2-5.el7.noarch libssh2-1.8.0-4.el7_9.1.x86_64 leapp-upgrade-el7toel8-0.16.0-6.el7.elevate.20.noarch elevate-release-1.0-2.el7.noarch leapp-0.14.0-1.el7.noarch
- Check the post-upgrade recommended actions in
/var/log/leapp/leapp-report.txt
file.
- Difference in Python versions and support in either AlmaLinux 8, Rocky Linux 8 or Oracle Linux 8.
Risk Factor: high
Title: Difference in Python versions and support in RHEL 8
Summary: In RHEL 8, there is no 'python' command. Python 3 (backward incompatible) is the primary Python version and Python 2 is available with limited support and limited set of packages. Read more here: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/configuring_basic_system_settings/#using-python3
Remediation: [hint] Please run "alternatives --set python /usr/bin/python3" after upgrade
Run the proposed remediation command
$ sudo alternatives --set python /usr/bin/python3
- Changing SELinux mode to enforcing. During the in-place upgrade process, the
Leapp
utility sets SELinux mode to permissive. When the system is successfully upgraded, you have to manually change SELinux mode to enforcing.
Risk Factor: low
Title: SElinux will be set to permissive mode
Summary: SElinux will be set to permissive mode. Current mode: enforcing. This action is required by the upgrade process to make sure the upgraded system can boot without beinig blocked by SElinux rules.
Remediation: [hint] Make sure there are no SElinux related warnings after the upgrade and enable SElinux manually afterwards. Notice: You can ignore the "/root/tmp_leapp_py3" SElinux warnings.
Make sure the SELINUX=enforcing
is configured in /etc/selinux/config
.
$ sudo sed -i 's/^SELINUX=.*$/SELINUX=enforcing/' /etc/selinux/config
$ sudo cat /etc/selinux/config | grep ^SELINUX=
SELINUX=enforcing
- Force an SElinux auto relabel and reboot
$ sudo touch /.autorelabel
$ sudo reboot
- Optionally, remove all remaining upgrade-related data from the system. Before that, check the upgrade logs for any possible error messages.
$ sudo cat /var/log/leapp/leapp-upgrade.log
$ sudo rm -rf /var/log/leapp /root/tmp_leapp_py3 /var/lib/leapp
At this step, if all went well, the upgrade is finalized successfully.
References
- End dates are coming for CentOS Stream 8 and CentOS Linux 7
- ELevate Quickstart Guide
- Upgrading from RHEL 7 to RHEL 8.
For any questions related to this article, please contact ProComputers Support.
Why choose ProComputers?
With over 10 years of experience working with Microsoft Azure, ProComputers provides open-source software bundled together into solutions ready to be launched on-demand in the cloud.
ProComputers is a proud sponsor of the AlmaLinux OS Foundation and the Rocky Enterprise Software Foundation.
Red Hat and CentOS are trademarks or registered trademarks of Red Hat, Inc. or its subsidiaries in the United States and other countries. We are not affiliated with, endorsed by or sponsored by Red Hat or the CentOS Project.
All other trademarks are the property of their respective owners.