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
Change the /etc/hostname file
echo 'new.host.name' > /etc/hostname
Restart the hostname service
That’s it. The host name is now updated.