Wednesday 19 February 2014

Changing Hostname in Ubuntu

 

To change the hostname in ubuntu permanently you have to edit two files.

The first one is the file “hostname” located in the folder “/etc”. To edit this file using vi you can use the command “sudo vi /etc/hostname” in the terminal. To edit the file in gedit you can use the command “sudo gedit /etc/hostname”. No change the name given in this file and save the same.

After that you need to change one more file. Open the file “hosts” in the location “/etc’'. Edit this file and change the line containing the old hostname to new one. After that save the file. For editing you can either use the “vi” or “gedit” as mentioned in the previous paragraph. Just change the file path and name in that command.

Now restart ubuntu. It will be having the new name now.

No comments:

Post a Comment