AlmaLinux VPS Guide: The CentOS Replacement for Stable, Long-Term Production Servers
When Red Hat announced the end-of-life of CentOS 8 in December 2021 and the transition of CentOS to a rolling-release stream rather than a stable enterprise distribution, it disrupted the server infrastructure of thousands of organizations that depended on CentOS’s long-term stability and RHEL binary compatibility. AlmaLinux emerged as the community-supported answer — a free, open-source enterprise Linux distribution that maintains binary compatibility with Red Hat Enterprise Linux (RHEL) and provides the long-term support cycles that production servers require. This guide covers deploying a VPS on AlmaLinux and setting up a production-ready web server stack.
Why AlmaLinux for VPS Hosting?
Binary Compatibility with RHEL
AlmaLinux is built from RHEL source code, maintaining binary compatibility with RHEL and CentOS. Software, packages, and configurations designed for RHEL or CentOS work on AlmaLinux without modification. This makes AlmaLinux the most direct migration path for organizations running CentOS 7 or CentOS 8 infrastructure.
Long-Term Support Cycles
AlmaLinux 8 is supported until 2029; AlmaLinux 9 until 2032. This 10-year support window (matching RHEL’s lifecycle) makes AlmaLinux appropriate for production servers where stability and predictability matter more than the latest software versions. Compare this to Ubuntu LTS’s 5-year standard support or Debian’s approximately 3–5 year cycles.
Strong Enterprise Ecosystem
The RHEL-compatible ecosystem includes enterprise tools, monitoring agents, security scanners, and compliance frameworks that are certified against RHEL. AlmaLinux inherits this ecosystem. Organizations running enterprise software with RHEL certification can run it on AlmaLinux with confidence.
AlmaLinux vs Rocky Linux
Both AlmaLinux and Rocky Linux are community-maintained RHEL-compatible alternatives to CentOS. The key differences:
- AlmaLinux: Governed by the AlmaLinux OS Foundation; backed by CloudLinux; emphasizes RHEL ABI (binary interface) compatibility
- Rocky Linux: Governed by the Rocky Enterprise Software Foundation; founded by original CentOS creator Gregory Kurtzer; emphasizes RHEL-identical builds
Both are equally viable choices. AlmaLinux has slightly broader third-party repository support; Rocky Linux has a more conservative compatibility stance. Either serves as a reliable CentOS replacement.
AlmaLinux vs Ubuntu: Key Differences for VPS Administrators
| Feature | AlmaLinux 9 | Ubuntu 22.04 LTS |
|---|---|---|
| Package manager | DNF (Dandified YUM) | APT |
| Package format | RPM | DEB |
| Default firewall | firewalld | ufw (over iptables) |
| SELinux | Enabled by default (enforcing) | AppArmor (optional) |
| Init system | systemd | systemd |
| PHP availability | Via EPEL/Remi repositories | Via ondrej/php PPA |
| Support lifecycle | Until 2032 (AlmaLinux 9) | Until 2027 (22.04 LTS standard) |
| Enterprise adoption | High (RHEL ecosystem) | High (cloud-native ecosystem) |
Initial AlmaLinux VPS Setup
Update the System
dnf update -y
dnf install -y epel-release
Configure firewalld
AlmaLinux uses firewalld rather than UFW. The commands differ but the concepts are equivalent:
# Check status
sudo systemctl status firewalld
sudo firewall-cmd --state
# Allow HTTP, HTTPS, and SSH permanently
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --permanent --add-service=ssh
# Reload to apply
sudo firewall-cmd --reload
# Verify active rules
sudo firewall-cmd --list-all
Configure SELinux
SELinux is a major difference from Ubuntu. It provides mandatory access controls that restrict what services can do — a significant security benefit, but also a source of confusion when services fail to start or access files without clear error messages:
# Check SELinux mode
getenforce
# Returns: Enforcing (fully active), Permissive (logging only), or Disabled
# View SELinux denials (invaluable for troubleshooting)
sudo ausearch -m AVC -ts recent
# If Nginx cannot read web files, set the correct context:
sudo chcon -R -t httpd_sys_content_t /var/www/html
# Or use restorecon to restore default contexts:
sudo restorecon -Rv /var/www/html
Common SELinux boolean settings for web servers:
# Allow Nginx to connect to a network (for reverse proxy)
sudo setsebool -P httpd_can_network_connect 1
# Allow Nginx to connect to a database
sudo setsebool -P httpd_can_network_connect_db 1
# Allow PHP-FPM to use execmem (required by some PHP extensions)
sudo setsebool -P httpd_execmem 1
Create a Sudo User
adduser deploy
passwd deploy
usermod -aG wheel deploy # 'wheel' group = sudo access on RHEL/AlmaLinux
# Copy SSH authorized keys for new user
mkdir -p /home/deploy/.ssh
cp /root/.ssh/authorized_keys /home/deploy/.ssh/
chown -R deploy:deploy /home/deploy/.ssh
chmod 700 /home/deploy/.ssh
chmod 600 /home/deploy/.ssh/authorized_keys
Install Nginx on AlmaLinux
sudo dnf install nginx -y
sudo systemctl enable nginx
sudo systemctl start nginx
# Open port in firewalld
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --reload
AlmaLinux’s Nginx configuration follows the same structure as Ubuntu — server blocks in /etc/nginx/conf.d/ (Red Hat convention, though sites-available/sites-enabled also works):
sudo nano /etc/nginx/conf.d/yourdomain.com.conf
server {
listen 80;
listen [::]:80;
server_name yourdomain.com www.yourdomain.com;
root /var/www/yourdomain.com;
index index.php index.html;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass unix:/run/php-fpm/www.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
Note: AlmaLinux’s PHP-FPM socket path is /run/php-fpm/www.sock, not /var/run/php/ as on Ubuntu. Verify with:
ls /run/php-fpm/
Install PHP on AlmaLinux
AlmaLinux 9 ships with PHP 8.1. For PHP 8.2 or 8.3, use the Remi repository:
sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm
sudo dnf module reset php -y
sudo dnf module enable php:remi-8.2 -y
sudo dnf install php php-fpm php-mysqlnd php-gd php-mbstring php-xml \
php-curl php-zip php-bcmath php-intl php-redis php-opcache -y
sudo systemctl enable php-fpm
sudo systemctl start php-fpm
Configure OPcache:
sudo nano /etc/php.d/10-opcache.ini
opcache.enable=1
opcache.memory_consumption=256
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=20000
opcache.validate_timestamps=0
opcache.jit_buffer_size=128M
opcache.jit=tracing
Install MariaDB on AlmaLinux
sudo dnf install mariadb-server -y
sudo systemctl enable mariadb
sudo systemctl start mariadb
sudo mysql_secure_installation
# Create database
sudo mysql -u root -p
CREATE DATABASE myapp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'myapp'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON myapp.* TO 'myapp'@'localhost';
FLUSH PRIVILEGES;
\q
SELinux: Allow Nginx to Connect to PHP-FPM Unix Socket
# Set correct SELinux context on PHP-FPM socket directory
sudo chcon -t httpd_var_run_t /run/php-fpm/
sudo setsebool -P httpd_can_network_connect 1
Install SSL with Certbot
sudo dnf install certbot python3-certbot-nginx -y
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
DNF Package Management Reference
For administrators transitioning from Ubuntu/Debian:
| Action | DNF (AlmaLinux) | APT (Ubuntu) |
|---|---|---|
| Update package list | dnf check-update |
apt update |
| Upgrade all packages | dnf update -y |
apt upgrade -y |
| Install package | dnf install nginx -y |
apt install nginx -y |
| Remove package | dnf remove nginx -y |
apt remove nginx -y |
| Search packages | dnf search keyword |
apt search keyword |
| Package info | dnf info nginx |
apt show nginx |
| List installed | dnf list installed |
dpkg -l |
| Add repository | dnf config-manager --add-repo URL |
add-apt-repository |
Migrating from CentOS 7 or CentOS 8
AlmaLinux provides an official migration script for in-place upgrades from CentOS:
# Official CentOS 8 to AlmaLinux 8 migration
curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
bash almalinux-deploy.sh
For CentOS 7, the recommended path is a fresh AlmaLinux 9 installation rather than an in-place upgrade, due to the major version difference. Export your data, provision a fresh AlmaLinux 9 VPS, and redeploy your application stack.
Getting Started
AlmaLinux is available as a base image on KVM VPS plans at VPS.DO, providing the same KVM virtualization and NVMe storage as the Ubuntu options. For teams with existing RHEL/CentOS expertise or enterprise software that requires RHEL compatibility, AlmaLinux on a VPS delivers the familiar environment with long-term support through 2032.
Conclusion
AlmaLinux provides a stable, well-supported, and RHEL-compatible alternative to CentOS that is suitable for long-term production VPS deployments. The primary differences from Ubuntu — DNF package management, firewalld, and SELinux — require some familiarity but provide a more enterprise-oriented security model than Ubuntu’s defaults. For organizations with existing RHEL-compatible infrastructure or software requirements, AlmaLinux is the natural choice; for new deployments without RHEL requirements, both AlmaLinux and Ubuntu are excellent options with different tradeoffs in ecosystem and familiarity.