How to Change or Set a Hostname in AlmaLinux 9

Hey everyone, I’m setting up a new server using AlmaLinux 9 and I want to change the hostname to something more meaningful. Can anyone walk me through how to set or change the hostname properly on this distro?

You mean the computer’s hostname?

https://linuxconfig.org/change-hostname-on-almalinux

1 Like

To change or set the hostname in AlmaLinux 9, you can use the hostnamectl command. Open a terminal and run the following command:

sudo hostnamectl set-hostname your-new-hostname

Replace your-new-hostname with the desired hostname. To apply the changes immediately, you might need to restart network services using:

sudo systemctl restart systemd-hostnamed

To verify the change, you can use:

hostnamectl
1 Like

Sure! Just run hostnamectl set-hostname your-new-hostname as root, then reboot or log out and back in to see the change. Simple and quick on AlmaLinux 9!