This guide covers the essential first steps after deploying a new AlmaLinux or Rocky Linux VPS — connecting, updating, and creating a secure administrative user, adapted for the RHEL-family workflow.
Prerequisites
- An AlmaLinux 9 or Rocky Linux 9 VPS
- Root credentials or SSH key provided by your hosting provider
Step 1 — Connect via SSH
ssh root@YOUR_SERVER_IP
Step 2 — Update the System
sudo dnf update -y
Unlike Ubuntu/Debian's two-step apt update && apt upgrade, dnf update both refreshes package metadata and installs updates in one command.
Step 3 — Create a Sudo User
useradd deploy
passwd deploy
usermod -aG wheel deploy
The wheel group is the RHEL-family equivalent of Ubuntu/Debian's sudo group.
Step 4 — Verify Sudo Access
su - deploy
sudo whoami
Expected output: root
Step 5 — Set Up SSH Key Authentication
From your local machine:
ssh-copy-id deploy@YOUR_SERVER_IP
Step 6 — Check firewalld Status
AlmaLinux/Rocky Linux uses firewalld by default, not UFW:
sudo firewall-cmd --state
sudo firewall-cmd --list-all
See How to Configure firewalld on AlmaLinux/Rocky Linux for full configuration detail.
Step 7 — Check SELinux Status
getenforce
SELinux is enabled by default on AlmaLinux/Rocky Linux — a significant difference from Ubuntu/Debian's AppArmor-or-nothing default. See Understanding SELinux Basics on AlmaLinux/Rocky Linux before disabling it, since it provides meaningful additional security.
Step 8 — Set the Hostname
sudo hostnamectl set-hostname myserver.example.com
Step 9 — Set the Timezone
sudo timedatectl set-timezone UTC
Key Differences from Ubuntu/Debian to Keep in Mind
| Task | Ubuntu/Debian | AlmaLinux/Rocky Linux |
|---|---|---|
| Package manager | apt | dnf |
| Sudo group | sudo | wheel |
| Firewall | ufw | firewalld |
| Mandatory access control | AppArmor | SELinux |
| Default web root | /var/www/html | /var/www/html (same) |
Step 10 — Disable Root SSH Login
sudo nano /etc/ssh/sshd_config
PermitRootLogin no
sudo systemctl restart sshd
Note the service name is sshd, not ssh as on Ubuntu/Debian.
Common Errors
"Permission denied" running standard commands despite wheel membership — log out and back in for group membership to take effect.
Application fails with a permissions error despite correct file ownership — likely an SELinux context issue, not a standard permission issue; see Understanding SELinux Basics on AlmaLinux/Rocky Linux.
Best Practices
- Don't disable SELinux reflexively — learn to work with it, since it provides genuine additional security
- Use
firewalld's zone-based model rather than trying to force a UFW-like mental model onto it - Follow the same core security principles as any Linux VPS (SSH keys, updates, firewall) adapted to RHEL-family tooling
Related Articles
- How to Use dnf: The Package Manager for AlmaLinux & Rocky Linux
- How to Configure firewalld on AlmaLinux/Rocky Linux
- Understanding SELinux Basics on AlmaLinux/Rocky Linux
