The hostname is a feature with Linux operating systems that allows identification of a server. This can be used to easily determine the difference between two servers. Aside from personal identification of the server, the hostname is used with most network processes and other applications may rely on this as well. For example, cPanel / WHM uses the hostname for internal processes.
Display Current Hostname
Step One: Log into your server via SSH
Step Two: Type in the following command and hit Enter on your keyboard
How To Change Your Hostname In CentOS 7 and Debian 9 and Ubuntu 16.04 and Later
Step One: Log into your server via SSH as a user with sudo permissions
Step Two: Enter the command as follows, replacing NEWHOSTNAMEHERE with the hostname you are wanting to set for the system.
sudo hostnamectl set-hostname NEWHOSTNAMEHERE
Step Three: If you have any services that rely on the hostname, you may need to restart them for them to see the change. Alternatively, you can simply reboot the server to enact the change as well
The NEWHOSTNAMEHERE is typically entered in all lowercase letters
Type in the following command to confirm this change has been made and hit Enter on your keyboard
If using another version of Linux, you may be able to change the hostname by modifying the file at /etc/hostname to be the hostname that you are wanting to set. This will require a reboot of the server or services that rely on the hostname, including the Network service.
- Advanced Zone Editor – A detailed explanation on the Advanced Zone Editor within cPanel.
- How to Change Your Hostname in WHM
If you should have any questions or would like assistance, do feel free to contact us through Live Chat, on our Phones, or by submitting a ticket with our Technical Support team.