Monday 6 February 2017

How to change Hostname in Ubuntu Linux

1) Edit the /etc/hosts file and save it:
#sudo vi /etc/hosts
127.0.0.1       localhost
127.0.1.1       LSG-LOCALCITY --> change this with new hostname

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
~
~

1) Edit the /etc/hostname file and save it:
#sudo vi /etc/hostname 
root@LSG-LOCALCITY:~# vi /etc/hostname
LSG-LOCALCITY --> change this with new hostname
~
Finally, restart your computer to apply the changes.

No comments:

Post a Comment