A fresh Red Hat Enterprise Linux 9 installation is only the starting point. Before you deploy any workload, a proper RHEL 9 initial server setup makes the machine secure, updated and easy to manage. Out of the box, the system may not be registered, the firewall rules are minimal, and you are probably still logging in as root — all things you should fix in the first 30 minutes.
This guide walks you through the essential first steps of a RHEL 9 initial server setup: registering the system, applying updates, creating a sudo user, setting the hostname and timezone, enabling the firewall, and turning on automatic security updates. The same steps also work on RHEL 9 rebuilds such as AlmaLinux and Rocky Linux, except for the subscription registration part.
Prerequisites – RHEL 9 Initial Server Setup
- A server or virtual machine with RHEL 9 installed
- Root access or console access to the machine
- A Red Hat account with an active RHEL subscription (not needed for AlmaLinux/Rocky Linux)
- Internet connectivity for downloading updates
Step 1: Register the System and Apply Updates – RHEL 9 Initial Server Setup
Registration attaches your system to your Red Hat subscription so you can receive packages and security fixes. Register and attach subscriptions with:
subscription-manager register --username your_account --auto-attach
subscription-manager status
Next, update every package to the latest available version. A RHEL 9 initial server setup should never skip this step, because the installation media may be months old:
dnf check-update
dnf update -y
Install a small set of tools that almost every administrator needs:
dnf install -y vim curl wget tar net-tools bind-utils bash-completion
Step 2: Create a Sudo User During RHEL 9 Initial Server Setup
Working directly as root over SSH is risky. Create a personal admin account and add it to the wheel group, which grants sudo privileges on RHEL family systems:
adduser admin
passwd admin
usermod -aG wheel admin
Test the new account before you continue. Open a second terminal, log in as admin and verify sudo works:
sudo whoami
# Output should be: root
Once you confirm sudo access, you can later disable direct root SSH logins as described in our guide on how to SSH into a Linux server.

Step 3: Set the Hostname and Timezone
A meaningful hostname makes log files and monitoring much easier to read. Set it with hostnamectl:
hostnamectl set-hostname rhel9-prod-01
hostnamectl
Correct time is critical for logs, TLS certificates and Kerberos. Set your timezone and confirm synchronization:
timedatectl set-timezone Asia/Ho_Chi_Minh
timedatectl
Replace the timezone with your own; list all options with timedatectl list-timezones. If you also need to change the hostname on other distributions, see our tutorial on how to change hostname in Linux.
Step 4: Enable the Firewall
RHEL 9 ships with firewalld, but verify it is actually running and enabled at boot:
systemctl enable --now firewalld
firewall-cmd --state
firewall-cmd --list-services
By default only SSH and a few services are allowed. Keep it that way and open additional ports only when a service truly needs them.
Step 5: Enable Automatic Security Updates
Servers that are patched late are the ones that get compromised. Install dnf-automatic and configure it to apply security updates automatically:
dnf install -y dnf-automatic
vi /etc/dnf/automatic.conf
In the configuration file set upgrade_type = security and apply_updates = yes, then enable the timer:
systemctl enable --now dnf-automatic.timer
systemctl list-timers | grep dnf
Step 6: Reboot and Verify
If the update installed a new kernel, reboot once so the server runs it, then run a final verification:
reboot
cat /etc/redhat-release
dnf update --security --check 2>/dev/null || dnf check-update --security
ss -tulpn
The last command lists listening ports — there should be no surprises there.
Troubleshooting
subscription-manager says “This system is not yet registered”: run the register command again and confirm your account has an available subscription with subscription-manager list --available.
dnf fails with repository errors: usually the system is unregistered or the proxy blocks access. Check dnf repolist — on a registered RHEL 9 system you should see the BaseOS and AppStream repositories.
sudo command not found for the new user: the account is missing from the wheel group, or you edited sudoers incorrectly. Fix group membership from the root shell and never edit /etc/sudoers with anything except visudo.
Step 7: Confirm SELinux Is Enforcing
RHEL 9 ships with SELinux in enforcing mode, and a correct RHEL 9 initial server setup leaves it that way. Verify the current mode before you hand the server over:
getenforce
sestatus
The output should say Enforcing. If an application misbehaves, do not disable SELinux permanently — put it in permissive mode only while you diagnose the problem, read the denial in /var/log/audit/audit.log, and fix the context or boolean properly. Enforcing SELinux has stopped countless exploits from becoming full system compromises, and it costs you nothing once your services are labelled correctly.
Conclusion
A disciplined RHEL 9 initial server setup takes less than half an hour but pays off for the whole life of the machine: the system is registered and patched, you administer it with a personal sudo account instead of root, the firewall is on, and security updates apply themselves. From here you can continue with storage configuration, a web stack, or monitoring, knowing the foundation is solid.