Upgrade / Elevate CentOS 7 to AlmaLinux 8

Upgrade CentOS 7 to AlmaLinux 8 ELevate

As CentOS 7 approaches its end of life (EOL), migrating to a new, stable Linux distribution becomes increasingly important. AlmaLinux, a community-driven open-source fork of Red Hat Enterprise Linux (RHEL), is a popular replacement, offering long-term support and seamless compatibility with CentOS. In this tutorial, we will walk you through the steps to upgrade CentOS 7 to AlmaLinux 8 using the ELevate tool, ensuring a smooth transition and continued security updates for your system.

Introduction: Why Upgrade to AlmaLinux 8?

CentOS 7’s end of life in June 2024 signals the end of regular updates, patches, and security fixes. Without these, your system becomes vulnerable to security risks and incompatibilities. AlmaLinux 8, as a direct replacement, provides continued support, security updates, and long-term viability.

Alma Linux is binary-compatible with RHEL, which means that you can continue using the same tools, applications, and workflows without any major changes after migrating. AlmaLinux 8 provides support until at least 2029, making it a great choice for enterprises and individual users alike.

Key considerations before upgrading

Before starting the upgrade process from CentOS 7 to AlmaLinux 8, there are some critical preparatory steps you should follow to ensure the process is smooth and successful.

Backup your data

Upgrading an operating system always carries some level of risk, including potential data loss. Therefore, it’s crucial to create a complete backup of your system, including databases, application data, and configuration files. Tools such as rsynctar, or Bacula can be used for backups, or you can use cloud backup solutions like Rclone.

Review installed packages

Some packages installed on CentOS 7 may not have direct equivalents in AlmaLinux 8. You should review the currently installed packages and identify which ones might be affected by the upgrade.

List all installed packages using the command:

$ sudo rpm -qa

This will allow you to identify software that may need updates or alternative versions in AlmaLinux 8.

System Requirements

Ensure your system meets the basic hardware requirements for AlmaLinux 8:

  • Processor: 64-bit x86_64 architecture
  • RAM: Minimum 1 GB, recommended 2 GB or more
  • Disk Space: 10 GB for minimal installation, more for additional packages

Step-by-Step Guide: How to upgrade CentOS 7 to AlmaLinux 8

AlmaLinux provides the ELevate tool to handle the migration from CentOS 7 to AlmaLinux 8. This tool simplifies the migration process, allowing for in-place upgrades without needing to reinstall your system.

Step 1: Update Your CentOS 7 System

Before migrating, it’s important to update CentOS 7 to the latest available versions of packages. However, since CentOS 7 repositories are no longer active, you will need to swap to the CentOS vault, or use AlmaLinux’s mirror.

To switch to the AlmaLinux CentOS 7 mirror, run:

$ sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://el7.repo.almalinux.org/centos/CentOS-Base.repo
$  sudo curl https://repo.almalinux.org/elevate/el7/elevate.repo -o /etc/yum.repos.d/elevate.repo

Now, upgrade the system with the latest updates:

$ sudo yum upgrade -y
$ sudo reboot

Step 2: Install the ELevate Tool

After updating CentOS 7, the next step is to install the ELevate tool, which facilitates the migration process. This tool handles the transition between CentOS and AlmaLinux without needing to perform a fresh install.

First, install the elevate-release package, which contains the repository and GPG key for ELevate:

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

Now, install the necessary leapp packages, which are used to manage the upgrade and handle AlmaLinux as the target OS:

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

Step 3: Perform a Pre-Upgrade Check

The pre-upgrade check allows you to identify potential issues that could block the upgrade process. The leapp utility performs this check and generates a detailed report of any problems, including potential blockers. No packages are installed at this stage, ensuring that your system remains unchanged until you address the issues.

Run the pre-upgrade check using the following command:

$ sudo leapp preupgrade

The leapp utility will generate a report located at /var/log/leapp/leapp-report.txt. It’s essential to review this report thoroughly. The report contains a summary of potential issues along with recommended solutions.

Step 4: Address Pre-Upgrade Issues

In many cases, the pre-upgrade check will highlight issues that must be addressed before proceeding. These are often related to hardware drivers, configuration settings, or unsupported packages.

Some of the most common fixes for CentOS 7 include:

  • Remove pata_acpi module: This module is no longer supported in AlmaLinux 8. Remove it using the command:
$ sudo rmmod pata_acpi
  • Permit root login via SSH: The upgrade process may require root access through SSH. Update the SSH configuration as follows:
$ echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config
  • Answer Leapp Questions: In some cases, the leapp utility generates an answerfile that contains questions related to the upgrade. You will need to provide answers to these questions before proceeding. For example:
$ sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True

For more common issues, refer to the ELevate Frequent Issues page, which contains guidance on solving frequent problems.

Step 5: Start the Upgrade Process

Once the pre-upgrade issues are resolved, you can start the actual upgrade process. This step involves downloading and installing the necessary packages to upgrade CentOS 7 to AlmaLinux 8.

Run the following command to start the upgrade:

$ sudo leapp upgrade

The leapp utility will begin downloading the necessary AlmaLinux 8 packages and initiate the upgrade process. This may take some time, depending on your system’s performance and internet speed.

Step 6: Reboot into ELevate-Upgrade-Initramfs

Once the upgrade process completes, you will be prompted to reboot the system. Upon rebooting, the system will automatically boot into a new entry in GRUB called ELevate-Upgrade-Initramfs.

Reboot the system using:

$ sudo reboot

During this phase, the system will apply the upgrade changes. You can monitor the progress directly in the console. Your system will reboot automatically after the upgrade is complete.

Step 7: Verify the Upgrade

Once the system reboots after the upgrade, it’s essential to verify that the system is now running AlmaLinux 8. Use the following commands to check the OS version:

$ cat /etc/redhat-release
$ cat /etc/os-release

You should see output confirming that the system is running AlmaLinux 8.

Additionally, check the list of packages that were left from CentOS 7 by running:

$ rpm -qa | grep el7

You can also check the log files for any issues during the upgrade:

$ cat /var/log/leapp/leapp-report.txt
$ cat /var/log/leapp/leapp-upgrade.log

If there are any remaining CentOS 7 packages or configurations, you can remove or update them manually.

Post-Migration Steps

After upgrading to AlmaLinux 8, there are several post-migration steps to ensure that your system continues running smoothly.

Reinstall and Reconfigure Applications

Some applications may require reinstallation or reconfiguration after upgrading to AlmaLinux 8. Use dnf, the package manager for AlmaLinux 8, to install and manage packages. For example, to reinstall a package, use:

$ sudo dnf install <package_name>

Apply Regular System Updates

It’s crucial to keep your system updated with the latest security patches and package updates. Use the following command to update your AlmaLinux 8 system regularly:

$ sudo dnf update -y

Review Security Settings

After any major system upgrade, review your security configurations. Ensure that SELinux is enabled and configured correctly:

$ sestatus

Additionally, review your firewall settings and verify that services like firewalld or iptables are running as expected.

Performance Monitoring

Use performance monitoring tools like tophtop, or nmon to monitor system performance and resource usage. This will help you ensure that your upgraded system is running efficiently and can handle its workload.


Conclusion

Upgrading from CentOS 7 to AlmaLinux 8 is a necessary step for anyone looking to maintain a secure and stable server environment beyond CentOS 7’s end of life. Using the ELevate tool simplifies the process, allowing for an in-place upgrade without the need to reinstall your system or lose data. By following the steps outlined in this guide, you can ensure a smooth transition and enjoy continued support and updates from AlmaLinux.

LEAVE A COMMENT