CentOS 7 to AlmaLinux/Rocky Linux Upgrade Guide using ELevate: Fast, Efficient, No Reinstall Needed

CentOS tutorial - IT technology blog
CentOS tutorial - IT technology blog

CentOS 7 EOL and the Migration Challenge for DevOps

Since June 30, 2024, CentOS 7 has officially reached its End of Life (EOL). If you are still running servers on this OS, the security risks are significant as patches are no longer released. In my own experience, managing dozens of legacy servers running services like PHP 5.6 or Java 8 was a nightmare when considering migration.

The question is: Fresh Install or In-place Upgrade? A fresh install means setting up Nginx, MySQL configurations, folder permissions, and dozens of other small tweaks from scratch. With ELevate—an open-source project from the AlmaLinux team—you can upgrade directly from CentOS 7 to RHEL-based distributions while keeping your system state intact.

Why Choose ELevate Over a Fresh Install?

To give you a better idea, I’ll quickly compare these two methods based on my experience deploying about 20 servers at my workplace.

1. Fresh Install Method

  • Process: Back up data -> Install new OS -> Reconfigure environment -> Restore.
  • Issues: Downtime usually lasts 2-4 hours per server. The biggest risk is forgetting to back up config files scattered throughout /etc/.

2. Using ELevate (In-place Upgrade)

  • Process: Run an automated script to convert packages directly on the running OS.
  • Pros: Keeps Users, Crontab, SSH Keys, and running services. Saves about 80% of the time compared to reinstalling from scratch.
  • Cons: Prone to errors if the system has too many third-party libraries outside official repos.

Reviewing the ELevate Tool

ELevate isn’t just a simple script. It’s built on Red Hat’s Leapp framework to perform extremely rigorous checks.

Advantages:

  • Supports multiple targets: You can choose to upgrade to AlmaLinux, Rocky Linux, or even Oracle Linux.
  • Pre-upgrade check mechanism: The tool lists all potential risks before you make any actual changes.
  • Completely free and continuously supported by the community.

Note: The tool currently only supports the x86_64 architecture. If you’re using ARM-based servers, ELevate isn’t the solution yet.

Detailed Implementation Guide

Important Note: Perform a Snapshot or full Backup of all data before starting. Never trust OS upgrade tools 100%.

Step 1: Update CentOS 7 to the Latest Version

First, ensure your server is on version 7.9. Run the following command:

sudo yum update -y
sudo reboot

Step 2: Install the ELevate Repo

After the reboot, download the ELevate repo package to your machine.

sudo yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm

Step 3: Install Leapp and Target Data

Depending on whether you want to upgrade to AlmaLinux or Rocky Linux, install the corresponding package. I prefer AlmaLinux here for its high stability.

# Select AlmaLinux as the target
sudo yum install -y leapp-upgrade leapp-data-almalinux

Step 4: Run System Pre-upgrade Checks

This is the “health check” phase for the server. This command only scans the system and doesn’t perform the upgrade yet, so it’s very safe.

sudo leapp preupgrade

The results will be in the /var/log/leapp/leapp-report.txt file. If an “Inhibitor” error appears, you must resolve it. Here are the 3 most common errors I encounter:

  • PATA Driver: The new kernel no longer supports this driver. Fix: sudo rmmod pata_acpi.
  • PermitRootLogin: RHEL 8 requires explicit root permission confirmation. Fix: sudo echo PermitRootLogin yes >> /etc/ssh/sshd_config.
  • Answer file: You need to confirm the removal of the old PAM module with the command: sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True.

Step 5: Start the Upgrade

Once the preupgrade command reports SUCCESS, proceed with the actual upgrade command. This process usually takes 15 to 45 minutes depending on your hardware configuration.

sudo leapp upgrade
sudo reboot

Step 6: Confirm Results

After rebooting, the server will boot into a temporary upgrade environment. Do not interfere; let it run automatically. When the login screen appears, check the version again:

cat /etc/redhat-release
# Expected result: AlmaLinux release 8.10 (Cerulean Leopard)

“Hard-won” Lessons to Avoid Errors

After successfully migrating many systems, I’ve gathered a few points to keep in mind:

  1. /boot Partition Space: If this partition has less than 100MB free, the upgrade will definitely fail. Delete old kernels to free up space.
  2. Temporarily Disable SELinux: Switching to permissive mode helps avoid annoying permission errors while the script overwrites system files.
  3. Handle Third-party Repos: Repos like Remi or EPEL should be disabled before the upgrade. After reaching the new OS, reinstall the corresponding versions for RHEL 8.

Upgrading from CentOS 7 is no longer daunting if you master ELevate. I hope this article saves you a few sleepless nights migrating servers. If you encounter any strange errors during the Leapp process, feel free to leave the logs in the comments!

Share: