Labels

Arduino (1) Brainf**k (1) Bugs (3) C (1) HTML (1) Install (3) Linux (27) Maths (1) Python (12) Raspberry Pi (4)

Tuesday, 7 July 2015

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:

Step 1:
Edit /etc/hosts
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.

Step 2:
Edit /etc/hostname
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.

Step 3:
Restart the hostname service
sudo service hostname restart
or
sudo /etc/init.d/hostname restart