Linux penguin logo sitting in front of a server warehouse

This post describes how to change a hostname on a Debian 7 Linux server, however it will work on most other Linux distributions too.

Switch to root

sudo -i

Change the /etc/hostname file

echo '' > /etc/hostname

Restart the hostname service

/etc/init.d/ start

That’s it. The host name is now updated.