How to change the hostname on ubuntu server
Your hostname is a label that is assigned to your computer so that it can be identified.
There are only a couple of steps:
$ sudo vi /etc/hosts
You dont have to use vi you can open it with any text editor. Here you should see your current hostname, change it to the one you want.
$ sudo vi /etc/hostname
Here you should see not the hostname you just entered into /etc/hosts but the old one. Change it to your new one.
Restart the hostname service:
$ sudo service hostname restart
$ sudo /etc/init.d/hostname restart