AlmaLinuxCentOSLinuxTutorials

How To Migrate CentOS to AlmaLinux

Migrate CentOS to AlmaLinux

The unexpected end-of-life announcement for CentOS 8 sent shockwaves through the Linux community. System administrators worldwide found themselves facing a critical decision: continue running an unsupported operating system or migrate to a stable alternative. AlmaLinux emerged as the leading 1:1 binary-compatible replacement, offering seamless migration paths for CentOS 8 users. This comprehensive guide walks through the complete migration process, from preparation to post-migration verification, ensuring your server remains secure and fully functional.

Understanding CentOS 8 End of Life

The CentOS 8 EOL Timeline

Red Hat’s announcement in December 2020 fundamentally altered the CentOS landscape. Originally scheduled to receive support until May 2029, CentOS 8 reached its end-of-life on December 31, 2021—nearly eight years earlier than planned. This dramatic shift left organizations scrambling to find alternatives for their production infrastructure.

The decision to discontinue CentOS 8 stemmed from Red Hat’s strategic pivot toward CentOS Stream. Following IBM’s acquisition of Red Hat, the company restructured its enterprise Linux strategy, positioning CentOS Stream as a rolling-release distribution that sits between Fedora and RHEL. This fundamental change transformed CentOS from a downstream rebuild to an upstream development platform.

Security and Compliance Risks

Running an end-of-life operating system exposes servers to significant security vulnerabilities. Without official security patches, systems become increasingly vulnerable to exploits targeting known vulnerabilities. Critical CVEs remain unpatched, creating easy entry points for attackers. Organizations in regulated industries face compliance failures when audits reveal unsupported software in their infrastructure.

The impact extends beyond security concerns. Software vendors discontinued compatibility testing for CentOS 8, leading to potential dependency conflicts and application failures. Production systems running outdated packages risk operational disruptions that could impact business continuity and customer service delivery.

Why Choose AlmaLinux Over Other Alternatives

1:1 Binary Compatibility with RHEL

AlmaLinux provides complete binary compatibility with Red Hat Enterprise Linux, ensuring seamless transitions without configuration nightmares. Applications compiled for RHEL or CentOS run identically on AlmaLinux without modification. This compatibility eliminates the testing burden typically associated with operating system migrations.

The CloudLinux backing provides enterprise-grade stability while maintaining community-driven governance. Unlike corporate-controlled distributions, AlmaLinux operates through the AlmaLinux OS Foundation, ensuring long-term independence and community input in development decisions.

Long-Term Support and Security

AlmaLinux 8 receives support until 2029, matching the original CentOS 8 support timeline. Regular security patches address vulnerabilities promptly, often delivering fixes within hours of disclosure. The development team maintains active communication channels, providing transparency about security updates and bug fixes.

Control panel compatibility represents another crucial advantage. AlmaLinux officially supports cPanel, Plesk, and DirectAdmin installations, making it ideal for web hosting environments. System administrators can migrate without worrying about control panel incompatibility or licensing issues.

Free and Open Source

AlmaLinux remains completely free, with no licensing fees or subscription costs. Organizations can deploy unlimited instances without per-server charges. The open-source nature ensures transparency, allowing security audits and community contributions to improve the distribution continuously.

Key Differences Between CentOS 8 and AlmaLinux

Kernel and Performance Improvements

AlmaLinux 8 ships with the 4.18 Linux kernel, incorporating performance optimizations and hardware support improvements. Enhanced power management features reduce energy consumption on modern server hardware. Network stack improvements deliver better throughput and lower latency for high-traffic applications.

Package Manager Enhancements

The DNF package manager in AlmaLinux includes refined dependency resolution algorithms that reduce conflicts during updates. Module streams provide flexible application version management, allowing administrators to select specific software versions based on application requirements. Repository mirroring ensures reliable package availability through geographically distributed servers.

Security Features

AlmaLinux implements enhanced SELinux policies that provide granular access controls for containerized workloads. Updated cryptographic standards remove deprecated algorithms, ensuring compliance with modern security frameworks. Integrated security scanning tools help identify potential vulnerabilities before they become exploitable.

Cloud and Container Support

Native support for Podman provides Docker-compatible container management without daemon overhead. Kubernetes integration improvements streamline orchestration deployments. Cloud-init compatibility ensures seamless provisioning across AWS, Azure, Google Cloud, and private cloud platforms.

Prerequisites Before Migration

System Requirements Check

Before beginning migration, verify your CentOS version meets minimum requirements. AlmaLinux migration tools support CentOS 8.4 and newer versions. Check your current version using the command cat /etc/redhat-release. Systems running older versions require updating to CentOS 8.5 before migration proceeds.

Confirm system architecture compatibility by running uname -m. The migration process supports x86_64 architecture. Ensure adequate disk space exists for package downloads and temporary files. A minimum of 10GB free space in the root partition prevents migration failures due to insufficient storage.

Critical Pre-Migration Tasks

Creating comprehensive system backups represents the most critical pre-migration step. Full system snapshots or bare-metal backups enable complete recovery if migration encounters unexpected issues. Test backup restoration before proceeding to verify data integrity and recovery procedures.

Document current system configuration, including network settings, firewall rules, and custom application configurations. Generate a list of installed packages using rpm -qa > installed-packages.txt. This inventory proves invaluable for troubleshooting post-migration issues and verifying all applications migrated successfully.

Infrastructure Considerations

Establish reliable console access through SSH or physical console connections. VNC connections may disconnect during migration, leaving you unable to monitor progress or address errors. Configure SSH keepalive settings to prevent connection timeouts during long migration processes.

Schedule maintenance windows during low-traffic periods to minimize user impact. Typical migrations complete within 15-30 minutes, but allow buffer time for unexpected complications. Notify stakeholders about planned downtime and establish communication channels for status updates.

Fixing Outdated CentOS 8 Repositories

CentOS 8 repositories transitioned to vault.centos.org after reaching end-of-life. Update repository configurations before attempting system updates. Execute the following commands to modify repository URLs:

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

These commands comment out mirrorlist entries and update baseurl references to point to the vault repository. This modification enables package updates on end-of-life CentOS 8 systems that otherwise fail with repository errors.

Step-by-Step Migration Process Using AlmaLinux Deploy Script

Update Your CentOS 8 System

Connect to your server via SSH as the root user or a user with sudo privileges. Verify your current CentOS version displays correctly by examining the release file. The output confirms your starting point before migration begins.

Update all installed packages to their latest available versions:

sudo dnf update -y

This command downloads and installs all available updates, ensuring your system starts migration from the most current CentOS 8 package versions. The update process typically takes 5-15 minutes depending on the number of outdated packages.

Reboot the system after updates complete:

sudo reboot

Rebooting ensures the latest kernel loads and all updated services restart with new configurations. Reconnect via SSH after the system completes its boot cycle. Verify the kernel version using uname -r to confirm the latest kernel is active.

Download the AlmaLinux Migration Script

The official AlmaLinux deployment script automates the entire migration process. Download the script directly from the AlmaLinux GitHub repository:

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

This command retrieves the latest version of the migration script and saves it to your current directory. Verify successful download by listing the file with ls -lh almalinux-deploy.sh. The script size should be approximately 30-50 KB.

Optionally review the script contents before execution. Examining the script provides transparency about modifications it makes to your system. Use less almalinux-deploy.sh to review the code, though this step is not required for migration success.

Execute the Migration Script

Launch the migration process by running the downloaded script:

sudo bash almalinux-deploy.sh

The script performs comprehensive system checks before initiating migration. It verifies Secure Boot status, confirms CentOS version compatibility, and checks for potential conflicts. These preliminary validations prevent common migration failures.

The automated migration process includes multiple critical steps. First, it downloads the AlmaLinux GPG signing key and imports it to the RPM database, ensuring package authenticity verification. Next, it downloads the AlmaLinux release package and verifies its integrity using the imported GPG key.

The script systematically removes CentOS-specific packages, including centos-linux-release, centos-gpg-keys, and centos-linux-repos. These removals eliminate CentOS repository configurations and branding elements. AlmaLinux packages replace each removed component, maintaining system functionality throughout the transition.

Repository synchronization follows package replacement. The script executes dnf distro-sync, which updates, downgrades, and replaces packages to match AlmaLinux repositories. This operation touches 2,000-2,500+ packages on typical installations. Progress indicators display package processing status throughout the synchronization phase.

Monitor the output carefully for error messages or warnings. Most migrations complete without intervention, but occasional dependency conflicts require resolution. The process typically requires 15-30 minutes depending on system specifications and network bandwidth.

Handle Common GPG Key Issues

Some systems encounter GPG verification errors during migration. The error “digests SIGNATURES NOT OK” indicates missing or outdated AlmaLinux GPG keys. Resolve this issue by manually importing the official AlmaLinux signing key:

rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux

After importing the key, re-run the migration script:

sudo bash almalinux-deploy.sh

The script resumes from its last successful checkpoint, avoiding duplicate operations. This recovery mechanism ensures migration resilience even when interrupted by errors.

Complete the Migration

Wait for the migration completion message to appear in the terminal output. The script displays “Migration to AlmaLinux is completed” when all operations finish successfully. Additional messages about alternatives restoration and Secure Boot package reinstallation indicate normal post-migration cleanup.

The final output may include instructions to run dnf distro-sync -y. This command appears when repository synchronization completed but additional package updates became available. Running this optional command ensures absolute package version alignment with AlmaLinux repositories.

Review migration logs for detailed operation records. The script creates log files documenting each action performed during migration. These logs prove valuable when troubleshooting unexpected behavior or verifying migration completeness.

Post-Migration System Reboot and Verification

Reboot Your System

Initiate a system reboot to load the AlmaLinux kernel:

sudo reboot

The system disconnects SSH sessions during shutdown. Expected downtime ranges from 2-5 minutes for typical server configurations. Systems with extensive services or large disk arrays may require additional time for complete initialization.

GRUB bootloader displays AlmaLinux entries during startup. The default boot option should select the AlmaLinux kernel automatically. If multiple kernels appear, verify AlmaLinux versions appear first in the boot menu, indicating proper default configuration.

Verify AlmaLinux Installation

Reconnect to your server after the boot process completes. Check the release information to confirm successful migration:

cat /etc/redhat-release

Expected output displays: “AlmaLinux release 8.X (Codename)” where X represents the specific minor version and Codename indicates the release name such as “Stone Smilodon” or “Sapphire Caracal.”

Verify the default boot kernel references AlmaLinux:

sudo grubby --info DEFAULT | grep AlmaLinux

The title field should contain “AlmaLinux” followed by the kernel version. This confirmation ensures future reboots automatically load AlmaLinux kernels rather than residual CentOS kernels.

Check comprehensive system information using hostnamectl:

hostnamectl

The Operating System line must display “AlmaLinux” with version details. This command also reveals architecture information, kernel version, and system virtualization status in a single convenient output.

Examine active repositories using DNF:

dnf repolist

The output should display AlmaLinux repositories including BaseOS, AppStream, and Extras. CentOS repository references indicate incomplete migration or manual repository additions requiring cleanup.

Verify AlmaLinux branding packages installed correctly:

rpm -qa | grep almalinux

Multiple almalinux-branded packages should appear, including almalinux-release, almalinux-repos, and almalinux-gpg-keys. These packages confirm proper repository configuration and system branding.

Alternative Migration Method: Manual Migration

When to Use Manual Migration

Manual migration provides granular control over the conversion process. Administrators preferring step-by-step progression choose manual methods to observe each operation’s impact. Educational environments benefit from manual procedures that demonstrate Linux package management concepts.

Custom configurations sometimes require manual intervention to preserve specific settings. Organizations with strict change control policies may mandate manual migrations to document each modification. The manual process requires deeper Linux expertise but offers maximum flexibility.

Step 1: Remove CentOS Branding Packages

Begin by removing CentOS-specific packages that conflict with AlmaLinux equivalents:

sudo rpm -e --nodeps centos-linux-release centos-linux-repos centos-gpg-keys centos-logos

The --nodeps flag bypasses dependency checking, preventing removal failures due to packages depending on CentOS branding. This aggressive removal technique requires careful attention to ensure system stability.

Step 2: Install AlmaLinux Release Packages

Download and install AlmaLinux base packages from official repositories. Specify the exact version matching your target AlmaLinux release:

sudo rpm -Uvh https://repo.almalinux.org/almalinux/8/BaseOS/x86_64/os/Packages/almalinux-release-8.9-1.el8.x86_64.rpm

Install repository configuration packages:

sudo rpm -Uvh https://repo.almalinux.org/almalinux/8/BaseOS/x86_64/os/Packages/almalinux-repos-8.9-1.el8.x86_64.rpm

Install GPG key packages:

sudo rpm -Uvh https://repo.almalinux.org/almalinux/8/BaseOS/x86_64/os/Packages/almalinux-gpg-keys-8.9-1.el8.x86_64.rpm

These commands establish AlmaLinux repository infrastructure, enabling package management operations to access AlmaLinux packages.

Step 3: Synchronize Distribution Packages

Clean the DNF cache to remove stale metadata:

sudo dnf clean all

Execute distribution synchronization to align packages with AlmaLinux repositories:

sudo dnf distro-sync -y

This operation updates packages to AlmaLinux versions, replacing CentOS packages with binary-compatible AlmaLinux equivalents. The synchronization process mirrors the automated script’s behavior but provides visible progress for each package operation.

Step 4: Install AlmaLinux Kernel and Update GRUB

Install AlmaLinux kernel packages explicitly:

sudo dnf install -y kernel kernel-core kernel-modules

Regenerate GRUB bootloader configuration to incorporate new kernel entries:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

For UEFI systems, use the alternate GRUB configuration path:

sudo grub2-mkconfig -o /boot/efi/EFI/almalinux/grub.cfg

Step 5: Reboot and Verify

Follow the same verification procedures described in the automated migration section. Manual migrations achieve identical results to automated processes while providing enhanced visibility into each transformation step.

Troubleshooting Common Migration Issues

Dependency Problems and Missing Requires

Dependency conflicts occasionally prevent migration completion. Error messages indicating missing system-logos, system-backgrounds, or redhat-indexhtml packages signal incomplete package resolution.

Affected packages typically include anaconda-gui, firefox, gdm, gnome-session, and plymouth-graphics-libs. These graphical interface components depend on branding packages removed during CentOS package elimination.

Resolve dependency issues by installing missing packages manually:

yum install system-logos system-backgrounds redhat-indexhtml

After installing dependencies, retry the migration process. The script resumes operations and completes package replacements without repeating successful operations.

Version Compatibility Errors

Migration scripts reject CentOS versions below 8.4 to prevent incompatibilities. Systems running CentOS 8.0 through 8.3 require updating before migration proceeds. Update repository URLs to vault.centos.org as described in the prerequisites section.

Execute a full system update:

dnf update -y

Reboot after updating to activate the latest kernel and service configurations. Verify the updated version using cat /etc/redhat-release before attempting migration.

Network and Repository Access Issues

Network connectivity problems prevent package downloads during migration. DNS resolution failures manifest as “unable to resolve host” errors. Verify DNS configuration in /etc/resolv.conf contains valid nameserver entries.

Firewall rules sometimes block repository access. Temporarily disable firewall protection during migration to eliminate connectivity barriers:

systemctl stop firewalld

Remember to restart firewalld after migration completes and verify rules permit necessary network access.

Proxy environments require environment variable configuration before migration. Set HTTP and HTTPS proxy variables:

export http_proxy=http://proxy.example.com:8080
export https_proxy=http://proxy.example.com:8080

Air-gapped or offline environments cannot use standard migration scripts that require internet access. These scenarios demand creating local repository mirrors and modifying migration scripts to reference internal repositories.

Post-Migration Best Practices

Immediate Post-Migration Tasks

Update all packages immediately after migration to receive the latest security patches:

sudo dnf update -y

Search for orphaned packages not belonging to any active repository:

dnf list extras

Remove unnecessary packages to reduce maintenance burden and potential security exposure. Review system logs for error messages indicating service failures:

journalctl -xe

Test all critical applications thoroughly. Start services manually if they failed during migration, checking error logs for configuration issues requiring resolution.

Security Hardening

Review SELinux configurations if custom policies exist on your system. SELinux context changes may require relabeling filesystem contexts:

restorecon -Rv /path/to/directory

Update firewall rules in firewalld or iptables configurations. Verify SSH access remains properly configured with appropriate port settings and authentication methods. Enable automatic security updates by configuring DNF automatic:

dnf install dnf-automatic
systemctl enable --now dnf-automatic.timer

Application Testing

Test database connections for MySQL, MariaDB, or PostgreSQL instances. Verify connection strings work correctly and application queries execute without errors. Web servers require configuration verification—check Apache or Nginx configuration files for syntax errors and deprecated directives.

Control panel users should verify all panel functions operate correctly. Test website creation, email account management, and database administration interfaces. cPanel, Plesk, and DirectAdmin typically function identically after migration but warrant verification.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button