How to Migrate CentOS 7 to AlmaLinux 8 Using ELevate Repo

CentOS 7 reaches the end of life on June 30th, 2024 marking the end of the CentOS Project after CentOS 8 was prematurely discontinued back on December 31st in favor of CentOS Stream.

Thankfully, you can migrate from CentOS 7 to AlmaLinux 8 or any major Enterprise 8.x RHEL distributions such as Oracle Linux 8, Rocky Linux 8, or CentOS Stream 8 using the Elevate Project.

What is Elevate?

Elevate is a utility developed by AlmaLinux designed to facilitate the migration from CentOS 7 or any major versions of RHEL-based distros from 7.x to 8.x and from 8.x to 9.x. It provides the Leapp tool which initiates the actual upgrade process from one version to another.

The upgrade from CentOS 7 to any major RHEL-based distribution takes the following directions as illustrated in the diagram below.

Migrate CentOS 7 to AlmaLinux 8
Migrate CentOS 7 to AlmaLinux 8

If you are looking to switch from CentOS 7 to AlmaLinux 8, then you have come to the right place. In this guide, we will guide you on how to migrate from CentOS 7 to AlmaLinux 8 using the Elevate Project.

Preliminary Step

As is always recommended before migrating to any major release, it’s prudent to have a backup of your files in case something goes wrong during the upgrade. Therefore, take some time and take a backup copy of all the important files.

Step 1: Update CentOS 7 System

To get off the ground, log into your instance of CentOS 7 and upgrade the system to the latest version by running the following yum command.

$ sudo yum update
Update CentOS 7 Linux
Update CentOS 7 Linux

Once the update is complete, verify that CentOS 7 has been updated to the latest release as follows.

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

You should get the following as the output confirming that CentOS 7 has been updated to the latest release.

CentOS Linux release 7.9.2009 (Core)
Check CentOS 7 Linux
Check CentOS 7 Linux

Step 2: Install Elevate Repository in CentOS 7

The next step is to enable the Elevate repository on your CentOS 7 system by running the following command:

$ sudo yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm
Enable Elevate Repository on CentOS 7
Enable Elevate Repository on CentOS 7

To confirm that Elevate has successfully been installed, run the following rpm command.

$ rpm -qi elevate-release

You should get the following output providing intricate details about the elevate-release package including the version, release, architecture, install date and so much more.

Confirm Elevate Repository
Confirm Elevate Repository

Step 3: Install Leapp Utility in CentOS 7

The Elevate repository provides the Leapp utility which facilitates the actual migration of Red Hat Enterprise Linux 7.x distributions to any Enterprise Linux 8.x releases.

For example to migrate from CentOS 7 to AlmaLinux 8, install the following software packages.

$ sudo yum install -y leapp-upgrade leapp-data-almalinux
Install Leapp in CentOS 7
Install Leapp in CentOS 7

Step 4: Migrate CentOS 7 to AlmaLinux 8

Once the migration packages have successfully been installed, run the pre-flight upgrade checklist using the following command:

$ sudo leapp upgrade

The utility performs a series of checks to confirm if the system is ready for the switch to AlmaLinux 8. The CentOS 7 has some inherent issues that prevent the migration from taking as seen in the error report as shown below.

Run Pre-Flight Check Upgrade
Run Pre-Flight Check Upgrade

The pre-upgrade report is generated and saved in the /var/log/leapp/leapp-report.txt file. From here, you can view all the issues that prevent the migration to AlmaLinux.

In our case, we ran into a couple of issues. Firstly, our system had two kernels; something which hampers the migration to AlmaLinux 8. Your system must have only one kernel.

To check the number of installed kernels, run the command:

$ rpm -q kernel
Check Installed Kernel
Check Installed Kernel

If your system has multiple kernels, as is our case, delete all and remain with only one using the following command.

$ sudo package-cleanup --oldkernels --count=1

Once again, verify the number of kernels present in your system as follows.

$ rpm -q kernel
Verify Installed Kernel
Verify Installed Kernel

To fix the remaining issues, run the following commands, which allow remote root login using the SSH protocol.

$ sudo echo PermitRootLogin yes | sudo tee -a /etc/ssh/sshd_config

Next, run the following command to remove the pam_pkcs11 module in the PAM configuration

$ sudo leapp answer --section remove_pam_pkcs11_module_check.confirm=True

Finally, disable the pata_acpi module.

$ sudo rmmod pata_acpi

This time around, we only have one kernel remaining, which is great!

After fixing all the issues, proceed and perform the migration from CentOS 7 to AlmaLinux 8 by running the following command:

$ sudo leapp upgrade

This is a lengthy process and takes quite some time. Upon successful execution of the command, a report will be generated, and this time around, all indication is that everything went according to plan.

Upgrade CentOS 7 to AlmaLinux 8
Upgrade CentOS 7 to AlmaLinux 8

Next, reboot your system.

$ reboot

On the GRUB menu, you will find the ‘Elevate-Upgrade‘ entry. Press ENTER.

Choose ELevate Upgrade
Choose ELevate Upgrade

The upgrade to AlmaLinux 8 will continue and the system will reboot a couple of times.

Upgrade to AlmaLinux 8
Upgrade to AlmaLinux 8

Finally, the login screen will come into view. Provide your password and click ‘Sign In’ or hit ENTER to log in.

Login to AlmaLinux 8
Login to AlmaLinux 8

On the terminal, verify the version of AlmaLinux using the command below.

$ cat /etc/redhat-release
Check AlmaLinux Version
Check AlmaLinux Version

Alternatively, run the command.

$ cat /etc/os-release
Check AlmaLinux Release
Check AlmaLinux Release

The output confirms that we have successfully switched or migrated from CentOS 7 to Almalinux 8.7.

Conclusion

In this guide, we have demonstrated how to migrate from CentOS 7 to AlmaLinux 8 using the Elevate project which is an application that helps simplify the switch from Enterprise 7.x systems to Enterprise 8.x.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

James Kiarie
This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

5 Comments

Leave a Reply
  1. Hi Guys!

    This upgrade will be transparent for our workloads in docker? I was playing to deploy a new VM with Rocky and then export/import all related to docker but if we could upgrade easily with this tool I would go with the elevated project!!

    Regards!
    Ivan

    Reply
  2. Hi,

    I initiated the intermediate update of my centos7 Kernel:3.10.0-1160.102.1.el7.x86_64 to centos 8. My choice of migrating to Stream or RokyLinux has not yet been decided!

    Process ok until the command: "sudo rpm -e `rpm -q kernel`"

    I’m getting messages from publishers that are not very encouraging!

    " error: Failed dependencies:
    kernel >= 3.10.0-384.el7 is needed by (installed) hypervvssd-0-0.34.20180415git.el7.x86_64
    kernel >= 3.10.0-384.el7 is needed by (installed) hypervfcopyd-0-0.34.20180415git.el7.x86_64
    kernel >= 3.10.0-384.el7 is needed by (installed) hypervkvpd-0-0.34.20180415git.el7.x86_64
    kernel >= 3.10.0-1133.el7 is needed by (installed) kmod-kvdo-6.1.3.23-5.el7.x86_64 ....
    kernel(wake_up_process) = 0xe65cdceb is needed by (installed) kmod-kvdo-6.1 .3.23-5.el7.x86_64
    kernel(yield) = 0x760a0f4f is needed by (installed) kmod-kvdo-6.1.3.23-5.el7.x86_64"
    

    Here versioning state:

    cat /etc/redhat-release
    
    CentOS Linux release 8.5.2111
    

    [root@alpha yum.repos.d]# cat /etc/os-release

    NAME="CentOS Linux"
    VERSION="8"
    ID="centos"
    ID_LIKE="rhel fedora"
    VERSION_ID="8"
    PLATFORM_ID="platform:el8"
    PRETTY_NAME="CentOS Linux 8"
    ANSI_COLOR="0;31"
    CPE_NAME="cpe:/o:centos:centos:8"
    HOME_URL="https://centos.org/"
    BUG_REPORT_URL="https://bugs.centos.org/"
    CENTOS_MANTISBT_PROJECT="CentOS-8"
    CENTOS_MANTISBT_PROJECT_VERSION="8"
    

    Any suggestions would be appreciated
    Thanks in advance
    Regards
    Henri-Laurent

    Reply
    • @Henri,

      The error you’re encountering shows that there are missing dependencies for the installed kernel version. To resolve this issue, you can follow these general steps:

      First, update all packages, or specifically target the ones mentioned in the error message:

      sudo yum update
      sudo yum update hypervvssd hypervfcopyd hypervkvpd kmod-kvdo
      

      If updating the kernel and dependencies doesn’t resolve the issue, you may need to reinstall the problematic packages.

      sudo yum reinstall hypervvssd hypervfcopyd hypervkvpd kmod-kvdo
      

      After following these steps, the dependencies should be resolved.

      Reply
      • Hi Ravi,

        Many thanks for your answer.

        After reflection, I decided to stop the migration from the current Centos 7 server to 8 and install it on new hardware, Alma or Rocky OS, and gradually migrate my applications and services to the new server. A solution that is certainly more restrictive but less risky in terms of the availability of the existing system!

        I admit that I was somewhat careless in my first approach, thinking that the migration process was proven and not very risky!

        I want to stabilize my current centos 7 and be able to return from the Steps ( steps from the tecmint update process) already completed since my previous status:

        Here is my partial process migration :

        sudo rpmconf -a
        sudo package-cleanup --leaves
        sudo package-cleanup --orphans
        dnf  remove yum yum-metadata-parser
        sudo dnf  remove yum yum-metadata-parser
        sudo rm -rf /etc/yum
        sudo dnf --best --alloweraqsing  upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
        sudo dnf install http://vault.centos.org/8.5.2111/BaseOS/x86_64/os/Packages/{centos-linux-repos-8-3.el8.noarch.rpm,centos-linux-release-8.5-1.2111.el8.noarch.rpm,centos-gpg-keys-8-3.el8.noarch.rpm}
        

        Yum is removed and naturally, the old epel release and repository are replaced by a new depository! ( I use the dnf command from many years ago).

        Have you any idea how to downgrade the partial process recover precedent centos 7, and recover the correct repository and centos 7 references from /etc/redhat-release and /etc/os-release and others:?

        I greatly appreciate your help!
        Best regards Ravi
        Henri

        Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.