changing hostname in ubuntu

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: …