In a very quick note, this is how to change the local host name on a Debian or Ubuntu system. This can be especially useful if you did not install your server by yourself and euther rely on your provider’s automated installation or are using one of those pre-built virtual appliances (by the way, take a look at this site which maintains a very impressive collection, including many debian and ubuntu flavours).
Now to the point. You need to first edit the content of /etc/hostname with the new name :
user@box:~$ sudo -s
root@box:~$ nano /etc/hostname
and run the following init script :
user@box:~$ /etc/init.d/hostname.sh start
Also edit the content of /etc/hosts to reflect the change – there should be at least a line beginning with 127.0.1.1 that you will want to modify :
root@box:~$ nano /etc/hosts
You will have to exit your current console session and re-login to see your shell prompt updated. If you are running a Gnome / KDE or other X session, you should also restart it (Ctrl+Alt+Backspace).
That’s it ! As I said, a quick one today.