I cloned a virtual server and late realised they had the same hostname.
No problem.
- change the hostname in /etc/hostname:
sudo nano /etc/hostname
- change the hostname in /etc/hosts:
this file will contain localhost and your old hostname. eg,
127.0.0.1 localhost 127.0.1.1 <new-host-name>
edit this file to suit.
Finally, change the hostname in the current session:
This can be done one of two ways. Restart the system, or issue the following command:
sudo hostname <new-host-name>