Updating your hostname on linux server

tom on February 16th, 2007

This is a very simple task, however many linux server newbies will be hard pressed to figure it out on their own.

First, edit your /etc/hosts file with vi /etc/hosts

Second, change any lines such as:

127.0.0.1  new.server.com server localhost.localdomain localhost

Simple change the “new.server.com server” part to a valid hostname, Such as: your.host.com yourhost.

Then save the file with :wq command.

If everything was configured correctly, set the new hostname with the following command:

# hostname your.host.com

and everything should be good!


Comments are closed.