๐ AlmaLinux vs CentOS: Complete Migration Guide for Beginners
Worried about your CentOS future? Donโt be! ๐ฏ Today weโll explore everything about migrating from CentOS to AlmaLinux - the community-driven, enterprise-grade Linux thatโs taking the world by storm! Whether youโre running one server or thousands, this guide makes migration simple and stress-free! ๐
๐ค Why is AlmaLinux the Best CentOS Alternative?
Choosing AlmaLinux brings incredible advantages:
- ๐ 1:1 RHEL compatibility - Drop-in replacement for CentOS with binary compatibility
- ๐ง Long-term support - 10 years of updates and security patches guaranteed
- ๐ Community-driven - No single company control, truly open source
- ๐ Enterprise-ready - Production-grade stability trusted by Fortune 500 companies
- โญ Free forever - No licensing fees, no subscription requirements
๐ฏ What You Need
Before starting your migration journey:
- โ Current CentOS 7, 8, or Stream system
- โ Root or sudo access to your server
- โ Backup of critical data (always backup first!)
- โ 30-60 minutes for migration (depending on system size)
- โ Internet connection for downloading packages
๐ Step 1: Understanding the Key Differences
Letโs understand what makes AlmaLinux special! ๐
CentOS vs AlmaLinux Comparison
# Check your current CentOS version
cat /etc/centos-release
# Example output: CentOS Linux release 8.5.2111
# Key differences to understand:
echo "=== CentOS vs AlmaLinux Comparison ==="
echo "CentOS 8: EOL December 31, 2021 (already ended!)"
echo "CentOS 7: EOL June 30, 2024 (ending soon!)"
echo "CentOS Stream: Rolling release (not stable for production)"
echo ""
echo "AlmaLinux 8: Supported until 2029"
echo "AlmaLinux 9: Supported until 2032"
echo "AlmaLinux: Stable releases perfect for production!"
Why Organizations Are Switching
# Real-world migration statistics
echo "๐ Migration Facts:"
echo "- 80% of CentOS users considering AlmaLinux"
echo "- 500,000+ AlmaLinux installations worldwide"
echo "- Major companies already migrated: CloudLinux, cPanel, Plesk"
echo "- Zero licensing costs vs RHEL subscription fees"
Pro tip: ๐ก AlmaLinux is backed by the AlmaLinux OS Foundation, a 501(c)(6) non-profit, ensuring it stays free and open forever!
๐ง Step 2: Pre-Migration Preparation
Prepare your system for a smooth migration:
Backup Your System
# Create a full system backup (adjust paths as needed)
echo "๐ Creating system backup..."
# Backup important configurations
sudo tar -czf /backup/etc-backup-$(date +%Y%m%d).tar.gz /etc/
sudo tar -czf /backup/home-backup-$(date +%Y%m%d).tar.gz /home/
# Backup database if you have one
if command -v mysqldump &> /dev/null; then
mysqldump --all-databases > /backup/mysql-backup-$(date +%Y%m%d).sql
fi
# List installed packages for reference
rpm -qa > /backup/installed-packages-$(date +%Y%m%d).txt
echo "โ
Backup completed! Files saved in /backup/"
System Health Check
# Check system health before migration
echo "๐ฅ Performing system health check..."
# Check disk space (need at least 5GB free)
df -h / | grep -v Filesystem
# Check current kernel
uname -r
# Check for any broken packages
sudo rpm -Va | grep -E '^..5'
# Update current system
sudo yum update -y
echo "โ
System ready for migration!"
Document Current Configuration
# Save current system state for comparison
echo "๐ Documenting system configuration..."
# Network configuration
ip addr show > /backup/network-config.txt
# Service status
systemctl list-units --state=running > /backup/running-services.txt
# Firewall rules
sudo firewall-cmd --list-all > /backup/firewall-rules.txt
# Repository list
yum repolist > /backup/repo-list.txt
echo "โ
Configuration documented!"
๐ Step 3: Performing the Migration
Now for the exciting part - the actual migration! ๐
Method 1: Using AlmaLinux Migration Tool (Recommended)
# Download and run the official migration script
echo "๐ Starting AlmaLinux migration..."
# Download the migration tool
curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
# Make it executable
chmod +x almalinux-deploy.sh
# Run the migration (this will take 15-30 minutes)
sudo ./almalinux-deploy.sh
# The script will:
# 1. Check system compatibility
# 2. Replace CentOS repositories with AlmaLinux
# 3. Update all packages to AlmaLinux versions
# 4. Update boot loader and kernel
Method 2: Manual Migration for CentOS 8
# Manual migration steps for more control
echo "๐ง Manual migration process..."
# Step 1: Remove CentOS branding packages
sudo rpm -e --nodeps centos-linux-release centos-linux-repos centos-gpg-keys centos-logos
# Step 2: Install AlmaLinux release packages
sudo rpm -Uvh https://repo.almalinux.org/almalinux/8/BaseOS/x86_64/os/Packages/almalinux-release-8.9-1.el8.x86_64.rpm
sudo rpm -Uvh https://repo.almalinux.org/almalinux/8/BaseOS/x86_64/os/Packages/almalinux-repos-8.9-1.el8.x86_64.rpm
sudo rpm -Uvh https://repo.almalinux.org/almalinux/8/BaseOS/x86_64/os/Packages/almalinux-gpg-keys-8.9-1.el8.x86_64.rpm
# Step 3: Clean and update
sudo dnf clean all
sudo dnf distro-sync -y
# Step 4: Install AlmaLinux kernel
sudo dnf install -y kernel kernel-core kernel-modules
# Step 5: Update GRUB
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Monitoring Migration Progress
# Watch migration progress in another terminal
watch -n 2 'tail -20 /var/log/dnf.log'
# Check for any errors
grep -i error /var/log/dnf.log
# Monitor system resources during migration
top
What happens during migration: ๐
- Repository URLs are updated to AlmaLinux mirrors
- All packages are synchronized with AlmaLinux versions
- System branding is updated to AlmaLinux
- Kernel and bootloader are updated
- All your data and configurations remain intact!
โ Step 4: Post-Migration Verification
Verify your successful migration:
System Verification
# Verify AlmaLinux installation
echo "๐ Verifying migration success..."
# Check OS version
cat /etc/redhat-release
# Should show: AlmaLinux release 8.9 (Midnight Oncilla)
# Verify kernel
uname -r | grep el8
# Check AlmaLinux repos
dnf repolist | grep -i alma
# Verify system is up to date
sudo dnf check-update
echo "โ
Migration verified successfully!"
Service Verification
# Check all services are running properly
echo "๐ง Checking services..."
# Compare with pre-migration service list
systemctl list-units --state=running > /tmp/new-services.txt
diff /backup/running-services.txt /tmp/new-services.txt
# Check critical services
for service in sshd NetworkManager firewalld; do
echo "Checking $service..."
systemctl status $service --no-pager | head -3
done
# Test network connectivity
ping -c 3 google.com
Application Testing
# Test your applications
echo "๐งช Testing applications..."
# If you have a web server
if systemctl is-active --quiet httpd; then
curl -I localhost
fi
# If you have a database
if systemctl is-active --quiet mysqld; then
mysql -e "SELECT VERSION();"
fi
# Check listening ports
ss -tulpn | grep LISTEN
echo "โ
All applications working!"
๐ฎ Quick Examples
Example 1: Migrating a Web Server ๐
# Complete web server migration example
echo "๐ Migrating CentOS web server to AlmaLinux..."
# 1. Backup website data
tar -czf /backup/website-$(date +%Y%m%d).tar.gz /var/www/
# 2. Run migration
sudo ./almalinux-deploy.sh
# 3. Verify web server after migration
systemctl restart httpd
curl -I http://localhost
# 4. Test PHP if installed
php -v
echo "<?php phpinfo(); ?>" > /var/www/html/test.php
curl http://localhost/test.php | grep -i alma
echo "โ
Web server successfully migrated!"
Example 2: Migrating a Database Server ๐พ
# Database server migration with zero downtime
echo "๐พ Migrating database server..."
# 1. Create database backup
mysqldump --all-databases --single-transaction > /backup/db-pre-migration.sql
# 2. Note current version
mysql -V
# 3. Perform migration
sudo ./almalinux-deploy.sh
# 4. Verify database after migration
systemctl status mysqld
mysql -e "SHOW DATABASES;"
mysql -e "SELECT @@version;"
# 5. Run test queries
mysql -e "SHOW STATUS LIKE 'Uptime';"
echo "โ
Database server migration complete!"
Example 3: Migrating a Docker Host ๐ณ
# Migrate Docker host from CentOS to AlmaLinux
echo "๐ณ Migrating Docker host..."
# 1. List running containers
docker ps > /backup/docker-containers.txt
# 2. Save docker images
docker save $(docker images -q) -o /backup/docker-images.tar
# 3. Run migration
sudo ./almalinux-deploy.sh
# 4. Reinstall Docker
sudo dnf install -y docker-ce docker-ce-cli containerd.io
# 5. Restore and verify
docker load -i /backup/docker-images.tar
docker ps
echo "โ
Docker host successfully migrated!"
๐จ Fix Common Problems
Problem 1: Repository Errors During Migration โ
Symptoms:
- โCannot find valid baseurl for repoโ errors
- Repository metadata download failures
Try this:
# Fix repository issues
sudo dnf clean all
sudo rm -rf /var/cache/dnf/*
# Manually update repo files
sudo curl -o /etc/yum.repos.d/almalinux.repo https://repo.almalinux.org/almalinux/8/almalinux.repo
# Retry the sync
sudo dnf distro-sync -y --allowerasing
Problem 2: Package Conflicts โ
Try this:
# Resolve package conflicts
# Remove conflicting packages
sudo dnf remove -y centos-backgrounds centos-logos
# Force AlmaLinux packages
sudo dnf install -y almalinux-backgrounds almalinux-logos --allowerasing
# Clean and retry
sudo dnf clean all
sudo dnf distro-sync -y --skip-broken
Problem 3: Boot Issues After Migration โ
Check these things:
# Regenerate initramfs
sudo dracut -f --regenerate-all
# Update GRUB configuration
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
# Set default kernel
sudo grubby --set-default /boot/vmlinuz-$(uname -r)
# Verify boot entries
sudo grubby --info=ALL | grep -E "^kernel|^title"
๐ Simple Commands Summary
Task | Command |
---|---|
๐ Check CentOS version | cat /etc/centos-release |
๐ง Run migration tool | sudo ./almalinux-deploy.sh |
๐ Verify AlmaLinux | cat /etc/redhat-release |
๐ Check migration logs | tail -f /var/log/dnf.log |
โป๏ธ Update system | sudo dnf update -y |
๐ Check repos | dnf repolist |
โ Verify services | systemctl list-units --state=running |
๐ก Tips for Success
- Always backup first ๐ - Never skip the backup step, even for test systems
- Test in staging ๐ - Try migration on a test server before production
- Schedule downtime ๐ - Plan 1-2 hours of maintenance window
- Monitor closely ๐ - Watch logs during migration for any issues
- Keep documentation ๐ - Document your specific migration steps and any customizations
๐ What You Learned
Congratulations! Now you can:
- โ Understand why AlmaLinux is the best CentOS replacement
- โ Prepare systems properly for migration
- โ Perform seamless migration from CentOS to AlmaLinux
- โ Verify successful migration and troubleshoot issues
- โ Migrate various server types (web, database, Docker)
๐ฏ Why This Matters
Your migration to AlmaLinux provides:
- ๐ Long-term stability with 10 years of guaranteed support
- ๐ Enterprise-grade security with timely patches and updates
- ๐ Cost savings with no licensing or subscription fees
- โก Community support from a vibrant, growing ecosystem
Remember: AlmaLinux is more than just a CentOS replacement - itโs a community-driven enterprise Linux that ensures your infrastructure remains stable, secure, and free forever! โญ
Youโve successfully mastered CentOS to AlmaLinux migration! Your servers are now running on a rock-solid, community-backed enterprise Linux distribution that will serve you reliably for years to come! ๐