How to Migrate CentOS 7 to Rocky or AlmaLinux Using ELevate

Linux tutorial - IT technology blog
Linux tutorial - IT technology blog

The CentOS 7 Support Gap

CentOS 7 officially retired on June 30, 2024. If you are still managing legacy servers, this date wasn’t just a footnote; it was the day your infrastructure became a security liability. Running an EOL distribution means you are no longer receiving critical kernel patches or security updates. While the traditional fix was a “wipe and reinstall,” that process is often a nightmare for complex production environments with specific configuration needs.

Major OS upgrades used to be stressful events that broke custom dependencies and caused hours of troubleshooting. The AlmaLinux team simplified this by releasing ELevate, an open-source project designed for in-place migrations. It allows you to move from CentOS 7 to RHEL 8-based distributions like Rocky Linux or AlmaLinux without formatting your drives. After testing this on a fleet of 50+ servers, I found it to be the most reliable path for aging machines.

How the ELevate Framework Works

Think of ELevate as a sophisticated brain for the Leapp utility, which Red Hat originally built for RHEL upgrades. It doesn’t just blindly swap repository URLs. Instead, the process happens in two distinct phases: a deep-dive pre-upgrade analysis and the actual package transaction.

This pre-upgrade phase is your safety net. It scans hardware drivers, kernel modules, and installed software to find potential deal-breakers. If a specific driver is missing in the target version, ELevate stops the process and alerts you before a single system file is modified. This level of protection makes it far safer than manual migration scripts.

Step 1: Preparation and Backups

Never touch an OS kernel without a verified backup. Whether you use a VM snapshot, a Veeam backup, or a simple rsync to an external drive, ensure you have a recovery plan. I once skipped this on a small staging node and spent an entire night rebuilding a database because the filesystem corrupted mid-migration. Don’t take that risk.

Start by ensuring your CentOS 7 system is fully patched to version 7.9:

sudo yum update -y
sudo reboot

Once the system reboots, confirm you are on the latest release:

cat /etc/redhat-release
# Output should be: CentOS Linux release 7.9.2009 (Core)

Step 2: Installing ELevate and Leapp

First, install the ELevate repository. This repo contains the modified Leapp tools and the metadata needed to bridge the gap between CentOS and its modern successors.

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

Your next move is to install the specific data package for your target OS. While you can choose Oracle Linux or EuroLinux, most teams opt for Rocky or AlmaLinux.

For AlmaLinux:

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

For Rocky Linux:

sudo yum install -y leapp-upgrade leapp-data-rocky

Step 3: Running the Pre-upgrade Check

Now comes the most important part of the process. This command performs a dry run and identifies conflicts without changing your data. On a standard VPS with 4GB of RAM and a 40GB SSD, this scan usually completes in less than three minutes.

sudo leapp preupgrade

Read the report generated at /var/log/leapp/leapp-report.txt. Your first run will almost certainly fail with “Inhibitors found.” This is normal. The tool is simply protecting you from a broken system.

Most failures are caused by a few common issues:

  • Deprecated Drivers: Support for old hardware like floppy drives or certain PATA controllers is removed in RHEL 8.
  • SSH Config: RHEL 8 forbids root login via SSH by default.
  • Answer Files: The tool requires you to explicitly acknowledge certain risks.

To clear these blockers, you typically run commands like these:

# Remove the old floppy driver if it is not in use
sudo rmmod floppy

# Confirm you want to remove the pam_pkcs11 module
sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True

Step 4: Executing the Migration

When the preupgrade command finally returns a green light, you are ready to migrate. This step downloads roughly 500MB to 1GB of new packages and builds a temporary boot environment.

sudo leapp upgrade

Expect the process to take 10 to 20 minutes depending on your disk speed. Once the command finishes successfully, the system will prompt you to restart. This is the official point of no return.

sudo reboot

Watch the GRUB boot menu during the restart. You will see a new entry: “ELevate-Upgrade-Initramfs.” The server will boot into this environment and begin replacing thousands of CentOS 7 packages with Rocky or AlmaLinux 8 versions. It may look stuck at 90% for a few minutes. Be patient and let it finish.

Step 5: Post-Migration Cleanup

Log in once the system reboots for the final time. You should see the login banner for your new operating system. Verify the version to be sure:

cat /etc/redhat-release
# Example Output: Rocky Linux release 8.10 (Green Obsidian)

Check your essential services immediately. Since RHEL 8 uses nftables instead of iptables, verify your firewall rules are still functioning as expected:

systemctl status httpd
systemctl status mariadb
sudo nft list ruleset

Wrap up by cleaning up the old package cache and removing the migration tool to keep the system lean:

sudo dnf clean all
sudo yum remove leapp-upgrade leapp-data-rocky

The Bottom Line

Moving off CentOS 7 is no longer optional, but it doesn’t have to be a manual disaster. ELevate provides a structured, repeatable way to modernize your fleet without losing your custom configurations. By spending 15 minutes fixing inhibitors during the pre-check phase, you ensure a predictable transition. If you are still running CentOS 7, start your migration today—ELevate is the most efficient tool for the job.

Share: