I had to look this up (I forgot about /etc/hosts):
To rename an Ubuntu server (in this case 12.04), SSH to the server and:
- sudo hostname (update name)
- sudo vi /etc/hosts (update name)
- sudo service hostname start (restart hostname service)
That’s all you need.