AlmaLinux Initial OS Setup Guide
This article provides a practical and minimal initial setup guide for AlmaLinux after a fresh installation, suitable for server environments.
AlmaLinux requires essential system configuration after installation to ensure secure, manageable, and network-accessible operation. These steps establish a solid foundation before deploying any application.
Step 1: Change Hostname
Section titled “Step 1: Change Hostname”hostnamectl set-hostname your-hostnameecho "127.0.0.1 localhost your-hostname" >> /etc/hostsStep 2: Configure Network (Example: Static IP)
Section titled “Step 2: Configure Network (Example: Static IP)”nmcli con mod "eth0" ipv4.addresses 192.168.1.100/24nmcli con mod "eth0" ipv4.gateway 192.168.1.1nmcli con mod "eth0" ipv4.dns 8.8.8.8nmcli con mod "eth0" ipv4.method manualnmcli con up "eth0"Step 3: Set Proxy (If Required)
Section titled “Step 3: Set Proxy (If Required)”cat <<EOF > /etc/profile.d/proxy.shexport http_proxy="http://proxy.example.com:8080"export https_proxy="http://proxy.example.com:8080"export no_proxy="localhost,127.0.0.1"EOFchmod +x /etc/profile.d/proxy.shsource /etc/profile.d/proxy.shecho 'proxy=http://proxy.example.com:8080' >> /etc/dnf/dnf.confStep 4: Disable SELinux
Section titled “Step 4: Disable SELinux”sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/configsetenforce 0Step 5: Update System
Section titled “Step 5: Update System”dnf update -ydnf upgrade -yStep 6: Configure Firewall
Section titled “Step 6: Configure Firewall”systemctl enable --now firewalldfirewall-cmd --permanent --add-service=sshfirewall-cmd --reloadStep 7: Set Timezone and NTP
Section titled “Step 7: Set Timezone and NTP”timedatectl set-timezone Asia/Tokyosystemctl enable --now chronydStep 8: Create Admin User with SSH Key
Section titled “Step 8: Create Admin User with SSH Key”useradd adminuserpasswd adminuserusermod -aG wheel adminusermkdir -p /home/adminuser/.sshchmod 700 /home/adminuser/.sshvi /home/adminuser/.ssh/authorized_keys # Paste public keychmod 600 /home/adminuser/.ssh/authorized_keyschown -R adminuser:adminuser /home/adminuser/.sshStep 9: Reboot to Apply SELinux Setting
Section titled “Step 9: Reboot to Apply SELinux Setting”rebootConclusion
Section titled “Conclusion”This minimal setup prepares an AlmaLinux system for secure and reliable server use. It includes hostname configuration, network and proxy setup, system updates, essential tooling, SELinux disablement, and firewall and time settings.