How to Set or Change Hostname on AlmaLinux 8

To change the hostname on AlmaLinux 8, follow the steps below:

Step 1 : Check the current hostname by running:

Step 2 : Set the new hostname using the following command:

Step 3 : Verify the hostname by checking the configuration file:

Step 4 : Open the /etc/hosts file and update the hostname:

Step 5 : Reboot the system to apply the changes:

Congratulations, you have successfully changed the hostname on AlmaLinux 8.