Skip to content

Migrate to AlmaLinux

This guide walks you through using the official AlmaLinux migration tool almalinux-deploy to migrate from CentOS 7/8, CentOS Stream, RHEL, or other EL-compatible distributions to AlmaLinux.

Before starting the migration, confirm the following:

  • Operating system version: CentOS 7, CentOS 8, CentOS Stream 8/9, RHEL 7/8/9, Oracle Linux, Rocky Linux, or other EL-compatible systems
  • Disk space: At least 5 GB of free space on the /var partition (for downloading and caching packages)
  • Network connectivity: The server must be able to access the internet to download AlmaLinux packages
  • Root privileges: The migration process requires root or sudo privileges
  • Full backup: Be sure to create a system snapshot or full backup before migrating

Important: The migration process replaces core system packages and carries some risk. Always validate in a test environment before running it in production.

Confirm the current OS version
$ cat /etc/os-release
Back up the list of installed packages
$ rpm -qa --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort > ~/packages-before-migration.txt
Back up running services
$ systemctl list-units --type=service --state=running > ~/services-before-migration.txt
Back up yum/dnf repository configuration
$ cp -a /etc/yum.repos.d/ ~/yum.repos.d.bak/
Back up network configuration
$ nmcli connection show > ~/network-before-migration.txt
$ ip addr show > ~/ip-addr-before-migration.txt

almalinux-deploy is the official migration script provided by AlmaLinux, hosted on GitHub.

Install required tools
$ sudo dnf install -y curl
Download the migration script
$ curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
Verify the script was downloaded
$ ls -la almalinux-deploy.sh

Tip: If your server cannot access GitHub directly, you can download the script on another machine and transfer it to the target server via scp.

Basic Migration (CentOS 8 / CentOS Stream)

Section titled “Basic Migration (CentOS 8 / CentOS Stream)”
Run the migration script
$ sudo bash almalinux-deploy.sh

The script automatically performs the following steps:

  1. Detects the current operating system version
  2. Downloads AlmaLinux GPG keys and repository configuration
  3. Removes CentOS-specific packages (such as centos-release, centos-logos, etc.)
  4. Installs the corresponding AlmaLinux packages
  5. Runs dnf distro-sync to synchronize all packages to AlmaLinux versions

CentOS 7 migration requires upgrading to EL8 first, since almalinux-deploy primarily supports direct migration for EL8+. AlmaLinux provides the ELevate project to handle cross-major-version upgrades.

Install the ELevate repository (CentOS 7)
$ sudo yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm
Install the Leapp upgrade tool
$ sudo yum install -y leapp-upgrade leapp-data-almalinux
Run the pre-upgrade check
$ sudo leapp preupgrade

Note: leapp preupgrade generates a report listing all issues that require manual resolution. Carefully review /var/log/leapp/leapp-report.txt and address each one.

View the pre-upgrade report
$ sudo cat /var/log/leapp/leapp-report.txt
Proceed with the upgrade after resolving all issues
$ sudo leapp upgrade

After the upgrade completes, the system will automatically reboot into AlmaLinux 8.

If you need to migrate to a specific AlmaLinux version:

Migrate to AlmaLinux 9 (from an EL9 system)
$ sudo bash almalinux-deploy.sh -t 9

Third-party repositories may cause package conflicts during migration. Below are common approaches.

The EPEL repository usually adapts automatically, but it is recommended to temporarily disable it before migration:

Disable EPEL before migration
$ sudo dnf config-manager --set-disabled epel epel-modular 2>/dev/null
Re-enable EPEL after migration
$ sudo dnf install -y epel-release
$ sudo dnf config-manager --set-enabled epel

Remi / IUS / RPMFusion and Other Repositories

Section titled “Remi / IUS / RPMFusion and Other Repositories”
List all enabled third-party repositories before migration
$ dnf repolist --enabled | grep -v -E '^(baseos|appstream|extras|powertools|crb)'
Temporarily disable all third-party repositories
$ sudo dnf config-manager --set-disabled remi* ius* rpmfusion*

After migration, reinstall the third-party repository versions compatible with AlmaLinux:

Example: Reinstall the Remi repository (AlmaLinux 8)
$ sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm
Example: Reinstall the Remi repository (AlmaLinux 9)
$ sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm

If package conflicts occur during migration:

Check which packages do not belong to AlmaLinux repositories
$ rpm -qa --qf '%{NAME} %{VENDOR}\n' | grep -v "AlmaLinux" | sort
Force sync all packages to AlmaLinux versions
$ sudo dnf distro-sync -y
Verify the system version
$ cat /etc/os-release

The output should show AlmaLinux information:

NAME="AlmaLinux"
VERSION="8.9 (Midnight Oncilla)"
ID="almalinux"
Verify the distribution identifier package
$ rpm -qa | grep almalinux-release
Check for any remaining CentOS packages
$ rpm -qa | grep -i centos

If there are leftover packages, you can manually remove or replace them:

Remove leftover CentOS packages (if any)
$ sudo dnf remove centos-logos centos-indexhtml 2>/dev/null
$ sudo dnf distro-sync -y
Ensure GRUB configuration is correct
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg

For EFI systems:

Rebuild GRUB for EFI systems
$ sudo grub2-mkconfig -o /boot/efi/EFI/almalinux/grub.cfg
Reboot the system
$ sudo reboot
Verify the kernel after reboot
$ uname -r
Verify all services are running properly
$ systemctl list-units --type=service --state=failed

Migration script reports “not supported”

Section titled “Migration script reports “not supported””

Confirm that your source system version is in the supported list. CentOS 6 and earlier versions are not supported.

Confirm the system version
$ cat /etc/redhat-release

This may be caused by network issues preventing the key from being downloaded.

Manually import the AlmaLinux GPG key
$ sudo rpm --import https://repo.almalinux.org/almalinux/RPM-GPG-KEY-AlmaLinux-8

This is usually caused by third-party repository package conflicts.

Exclude specific packages and retry sync
$ sudo dnf distro-sync -y --exclude=<conflicting-package-name>
If the problem is severe, clear cache and retry
$ sudo dnf clean all
$ sudo dnf distro-sync -y

If the system enters GRUB rescue or fails to boot after restarting:

  1. Boot using installation media or rescue mode
  2. Mount the root partition
  3. chroot into the system
  4. Reinstall the kernel and GRUB
Repair boot from rescue mode
$ sudo mount /dev/sda2 /mnt
$ sudo mount /dev/sda1 /mnt/boot
$ sudo chroot /mnt
$ dnf reinstall kernel-core grub2-efi-x64 shim-x64
$ grub2-mkconfig -o /boot/efi/EFI/almalinux/grub.cfg
$ exit
$ sudo reboot

AlmaLinux supports Secure Boot, but re-enrollment may be required after migration:

Check Secure Boot status
$ mokutil --sb-state