Set your hostname and host file

Posted on Sunday March 13, 2016 / by Eric Potvin

The hostname uniquely identifies your computer on the local network. The hostname can be use in many services or applications. Once the hostname is set, it is not recommended to change it.

To setup the hostname run this command:

echo "choose_a_better_hostname" > /etc/hostname
hostname -F /etc/hostname

Now, let's set the hostname in the host file.

sudo vi /etc/hosts

and Add the IP address(es) and the the hostname:

127.0.0.1       localhost.localdomain	localhost
12.34.56.78     choose_a_better_hostname.domain.com	choose_a_better_hostname