CentOS Linux reached full end-of-life in 2024, leaving millions of servers running unsupported software with no security patches. For teams still running CentOS 7 or CentOS 8 on their Hong Kong VPS, migration to a maintained RHEL-compatible alternative is now a security necessity. The two leading replacements — AlmaLinux and Rocky Linux — are both excellent choices, but they have meaningful differences worth understanding before you migrate.
Why CentOS Reached EOL
Red Hat changed the CentOS project in 2020, shifting from CentOS Linux (a stable downstream rebuild of RHEL) to CentOS Stream (an upstream development branch). The last stable CentOS Linux releases are permanently out of support:
- CentOS Linux 8 — EOL December 31, 2021
- CentOS Linux 7 — EOL June 30, 2024
Running EOL CentOS in 2026 means no security patches for known CVEs. This is an unacceptable risk for any production VPS handling real traffic or user data.
AlmaLinux vs Rocky Linux: Comparison
| Feature | AlmaLinux | Rocky Linux |
|---|---|---|
| Founded by | CloudLinux | Original CentOS co-founder |
| RHEL binary compatibility | Yes (ABI compatible) | Yes (1:1 bug-compatible) |
| Release cadence | Fast (within days of RHEL) | Fast (within days of RHEL) |
| Support lifecycle | 10 years per major version | 10 years per major version |
| Current stable version | AlmaLinux 9.x | Rocky Linux 9.x |
| cPanel support | Yes (official) | Yes (official) |
| Plesk support | Yes | Yes |
| ARM64 support | Yes | Yes |
| Community size | Large | Large |
| Backing organisation | AlmaLinux OS Foundation | Rocky Enterprise Software Foundation |
For practical purposes, both are excellent drop-in CentOS replacements. AlmaLinux tends to release slightly faster after RHEL updates and has strong commercial backing from CloudLinux. Rocky Linux emphasises strict bug-for-bug RHEL compatibility. Either is a safe choice; pick based on your team’s familiarity or the recommendation of your hosting provider.
Option A: Fresh Installation on Hong Kong VPS
The cleanest migration path is a fresh VPS with AlmaLinux or Rocky Linux, followed by application migration. Server.HK offers both as OS options during VPS provisioning.
# After provisioning with AlmaLinux 9 or Rocky Linux 9:
# Update immediately after first login
dnf update -y
# Install common tools
dnf install -y epel-release
dnf install -y vim curl wget git htop net-tools unzip bind-utils
# Configure firewall (firewalld replaces iptables/ufw on RHEL-based systems)
systemctl enable --now firewalld
firewall-cmd --permanent --add-service=ssh
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reloadOption B: In-Place Migration from CentOS 7
AlmaLinux provides an official in-place migration tool — ELevate — that upgrades CentOS 7 directly to AlmaLinux 8 or 9 without reinstalling the OS. This preserves your application configuration, installed packages, and data.
# On your existing CentOS 7 VPS:
# Install ELevate migration tool
yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm
yum install -y leapp-upgrade leapp-data-almalinux
# Run pre-migration check
leapp preupgrade
# Review the report — fix any blocking issues
cat /var/log/leapp/leapp-report.txt | grep -A2 "INHIBITOR"Common Pre-Migration Issues to Fix
# Remove unsupported packages
yum remove -y kernel-devel # If flagged
yum remove -y python2-leapp # Version conflicts
# Disable unsupported kernel modules
echo "blacklist " > /etc/modprobe.d/migration.conf
# Remove third-party repos that conflict
ls /etc/yum.repos.d/ # Identify and disable non-standard repos# After resolving all inhibitors:
leapp upgrade
# System reboots into migration environment (~10-20 minutes)
# Then reboots again into AlmaLinux 8
# Verify migration success
cat /etc/almalinux-release # Should show AlmaLinux 8.xUpgrade from AlmaLinux 8 to 9
<code"># Use ELevate again for 8→9 upgrade dnf install -y leapp-upgrade leapp-data-almalinux leapp preupgrade --target 9.0 leapp upgrade
Option C: In-Place Migration from CentOS 8
# AlmaLinux provides almalinux-deploy script for CentOS 8
curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
bash almalinux-deploy.sh
# The script converts CentOS 8 repos to AlmaLinux repos and replaces packages
# Reboot required after completion
reboot
# Verify
cat /etc/almalinux-releaseFor Rocky Linux migration from CentOS 8, the migrate2rocky script performs an equivalent conversion:
curl -O https://raw.githubusercontent.com/rocky-linux/rocky-tools/main/migrate2rocky/migrate2rocky.sh
bash migrate2rocky.sh -r # -r flag for Rocky Linux
rebootPost-Migration: LEMP Stack on AlmaLinux/Rocky Linux 9
The package names differ slightly from Ubuntu/Debian. Here is the LEMP stack setup for RHEL 9 compatible distros:
# Install Nginx
dnf install -y nginx
systemctl enable --now nginx
# Install MySQL 8
dnf install -y mysql-server
systemctl enable --now mysqld
mysql_secure_installation
# Install PHP 8.2 (via Remi repo — RHEL 9 ships PHP 8.1)
dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
dnf module reset php -y
dnf module enable php:remi-8.2 -y
dnf install -y php php-fpm php-mysqlnd php-xml php-mbstring php-redis \
php-curl php-zip php-gd php-opcache php-intl
systemctl enable --now php-fpm
# Install Redis
dnf install -y redis
systemctl enable --now redisKey Differences from Ubuntu
# PHP-FPM socket location (different from Ubuntu)
# AlmaLinux/Rocky: /run/php-fpm/www.sock
# Ubuntu: /run/php/php8.2-fpm.sock
# Update Nginx fastcgi_pass accordingly:
fastcgi_pass unix:/run/php-fpm/www.sock;
# Service management: same systemctl commands
# Package manager: dnf (not apt)
# Config location: /etc/nginx/ (same), /etc/php.ini (vs /etc/php/8.2/fpm/php.ini)SELinux: The Key RHEL-Family Difference
RHEL-based systems (AlmaLinux, Rocky Linux) ship with SELinux enabled by default — Ubuntu does not. SELinux can block Nginx from reading web files or PHP-FPM from writing to certain directories if contexts are incorrect.
# Check SELinux status
getenforce # Should show: Enforcing
# Allow Nginx to connect to PHP-FPM (required)
setsebool -P httpd_can_network_connect 1
# Fix file context for web directories
semanage fcontext -a -t httpd_sys_content_t "/var/www/myapp(/.*)?"
restorecon -Rv /var/www/myapp
# Allow PHP-FPM to write to storage directories
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/myapp/storage(/.*)?"
restorecon -Rv /var/www/myapp/storage
# Debug SELinux denials (useful during setup)
ausearch -m AVC -ts recent | audit2allowSELinux enforcement is a security feature — resist the temptation to disable it with setenforce 0. Fix the contexts instead; it takes 10–15 minutes and meaningfully improves your server’s security posture.
cPanel Migration Considerations
cPanel supports AlmaLinux 8 and 9, and Rocky Linux 8 and 9 as officially supported operating systems. If your CentOS VPS runs cPanel:
# cPanel provides its own migration tool for ELevate upgrades
# Install cPanel ELevate integration
/scripts/elevate-cpanel --non-interactive --startThis upgrades both the OS and cPanel simultaneously. Back up all accounts before running — use cPanel’s built-in backup tool to export all accounts to an external destination first.
Conclusion
Both AlmaLinux and Rocky Linux are stable, long-term-supported CentOS replacements that run identically on a Hong Kong VPS. In-place migration via ELevate (AlmaLinux) or migrate2rocky is available for CentOS 8 servers; CentOS 7 requires the two-step ELevate path through AlmaLinux 8 then 9. Fresh installations on new VPS instances remain the cleanest option for complex applications.
The key post-migration adjustment for teams coming from Ubuntu is understanding SELinux — fix contexts rather than disabling enforcement, and your RHEL-compatible VPS will be more secure than its predecessor.
Migrate to a supported OS: Browse Server.HK Hong Kong VPS plans — AlmaLinux 9 and Rocky Linux 9 are available as OS options during provisioning.