Migrating CentOS 7 to AlmaLinux: A Step-by-Step Guide

Migrating CentOS 7 to AlmaLinux

Table of Contents

Get up to 50% off now

Become a partner with CyberPanel and gain access to an incredible offer of up to 50% off on CyberPanel add-ons. Plus, as a partner, you’ll also benefit from comprehensive marketing support and a whole lot more. Join us on this journey today!

June 20th, 2024, marked the end of life for CentOS 7, meaning it will no longer receive bug fixes, critical security updates, or new features. This is why it is crucial to migrate to another supported operating system.

If you are still on CentOS 7, here is your sign. AlmaLinux is an excellent alternative to CentOS 7. It is a community-driven enterprise distribution compatible with RHEL. The environment is similar to what the former provided.

This walk-through will help you with migrating from CentOS 7 to AlmaLinux without any hiccups.

Prerequisites needed for Migrating CentOS 7 To AlmaLinux

To prepare for a smooth migration, you must fulfill several prerequisites. Here is a detailed walkthrough to prepare your system for migrating CentOS 7 to AlmaLinux.

1. Check for supported

The migration from CentOS to AlmaLinux is only supported by CentOS 7 and CentOS 8 systems. Ensure you have the correct versions and update your system to the latest version to avoid issues during the migration.

Use this command to update your OS:

Tech Delivered to Your Inbox!

Get exclusive access to all things tech-savvy, and be the first to receive 

the latest updates directly in your inbox.

sudo yum update -y

2. Backup your data

Keep a backup of your data, such as critical files, databases, and configurations, to avoid data loss. Backup using an external storage, separate disk, or a remote desktop server. Here is an exact list of all that you need to backup:

  • System Configuration Files (/etc)
  • User Data (/home)
  • Application Data (databases, web server data)
  • Custom Scripts and Cron Jobs
  • Service Configuration
  • Installed Package List
  • Necessary Logs (/var/log)
  • SSH Keys and Configuration
  • Custom Network Configuration
  • Virtual Hosts and Containers
  • Email Server Configuration
  • Firewall and Security Configurations

3. Check for disk space

Ensure you have enough disk space for the migration and new packages.

4. Disable third-party repositories and SELinux

Disable any third party repositories to avoid issues in migration. You can re-enable them if they are compatible after the process. Set SELinux to permissive mode so that it does not interfere with installation.

Use command:

sudo setenforce 0

5. Install a migration tool

Install the office AlmaLinux migration tool, almalinux-deploy, which would help migrate to the new operating system. Use command:

sudo curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

Other small things include:

  • Ensure you have administration rights to perform migration.
  • Check for a stable internet connection to download AlmaLinux.
  • Review already installed packages to ensure that they are AlmaLinux 8 compatible.

Step-by-Step Guide for Migrating CentOS 7 to AlmaLinux 8

Migrating CentOS 7 to AlmaLinux 8 is fairly simple process but requires precision and time. Follow these steps closely to achieve the right results on your system. 

Enhance Your CyerPanel Experience Today!
Discover a world of enhanced features and show your support for our ongoing development with CyberPanel add-ons. Elevate your experience today!

Step 1: Update the System

Update your system to ensure everything is up to date before upgrading to the new OS. Run the following command to update your system: 

sudo yum update -y

Wait for the update to finish and reboot your system with the GUI command: 

sudo reboot

Step 2: Install Migration Package

The ELevate package enables users to migrate their system between different versions of RHEL derivatives. Install ELevate that is the project repository and the appropriate GPG key by running the follow command: 

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

Now wait for the download to complete. 

Step 3: Install Necessary Packages

One of the necessary packages for successful migration is the Leapp tool. It facilitates the migration process while transitioning between the distributions by handling changes, software packages, and other system aspects. 

Install Leapp and the necessary migration data for AlmaLinux by running the following command: 

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

Step 4: Start Pre-Upgrade Check

Before starting the final upgrading, perform pre-upgrades using the Leapp tool. The tool collects the system data, assesses upgradability, and generates a pre-upgrade report. Use the following command: 

sudo leapp preupgrade

If there are any potential problems, the pre-upgrade check will fail and will produce a problem report. The report will also suggest how to resolve them before the upgrade. 

Open the report using either cat or any text editor of your choice. 

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

Alternatively, Leapp also creates a /var/log/leapp/answerfile with a true/false question file. Check if it exists and answer all the questions. You can use these commands to fix the most common issues: 

sudo rmmod pata_acpi

The command removes the pata_acpi module from the kernel.

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

Step 5: Start Upgrade

After resolving all the issues from the pre-upgrade process, your system is ready to be upgraded. Run the following command line to start the upgrade: 

sudo leapp upgrade

The process will download all the necessary packages and data to prepare the system for upgrade. Wait for it to complete: 

sudo reboot

That is it, if you follow these steps closely you will have no issues migrating CentOS 7 to AlmaLinux.

Troubleshooting Common Issues

If you are stuck somewhere during the migration, here is a guide for trouble-shooting:

1. Migrating errors

If the migration tool fails, check logs for error messages:
less /var/log/leapp/leapp-report.txt

2. Missing tools or packages

Some CentOS packages might not be compatible with AlmaLinux. Reinstall such packages using the AlmaLinux repositories.

3. Service failures

Use this command to debug:
sudo journalctl -xe

4. SELinux Issues

Review and adjust the rules in the logs:
sudo ausearch -m AVC -ts recent

5. Kernel issues

Ensure you are using the correct version and all the drivers are installed.

Benefits of AlmaLinux 8

  1. AlmaLinux offers stable support for large enterprise-level environments.
  2. AlmaLinux is compatible with CentOS, which provides a seamless migration.
  3. It has a supportive community, which offers guides, updates, and more.
  4. Robust features, such as performance optimization, security, and compatibility with enterprise environments.
  5. Fully open-source, free to use without any subscription fees.

Conclusion – Migrating CentOS 7 To AlmaLinux

Migrating from CentOS to AlmaLinux is a tedious task, however, you can get lots of help online. This guide demonstrates how to do it in detail and also provides troubleshooting queries.

Frequently Asked Questions

1. Is the process of migrating CentOS 7 to AlmaLinux disruptive?

The migration process is not that hard if planned well. However, it is crucial to test migration in a staging environment before applying it to the development systems.

2. What command shall I use to back up data before migration?

You can back up your system using rsync or tar, or an external disk, use command:
rsync -avz /important/data /backup/location

3. What tools can I use for migrating Centos 7 to AlmaLinux?

Use the ELevate Project from AlmaLinux, which provides the leapp tool for smooth migrations between RHEL-based distributions.

Marium Fahim
Hi! I am Marium, and I am a full-time content marketer fueled by an iced coffee. I mainly write about tech, and I absolutely love doing opinion-based pieces. Hit me up at [email protected].
Unlock Benefits

Become a Community Member

SIMPLIFY SETUP, MAXIMIZE EFFICIENCY!
Setting up CyberPanel is a breeze. We’ll handle the installation so you can concentrate on your website. Start now for a secure, stable, and blazing-fast performance!