Linux (28) Python (13) Raspberry Pi (5) Bugs (3) Install (3) C (2) Brainf**k (1) HTML (1) Maths (1) Sorts (1)

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
sudo /etc/init.d/hostname restart

No comments:

Post a comment