Sunday, April 1, 2007

How to change your hostname

Debian/Ubuntu Linux

Debian based systems use the file /etc/hostname to read the hostname of the system at boot time and set it up using the init script /etc/init.d/hostname.sh.

- Edit /etc/hostname and update to your new hostname, you can then run /etc/init.d/hostname.sh to activiate the change.
- Update your /etc/hosts file to refelect new hostname

You can also use sysctl to change the hostname:

- sysctl kernel.hostname (To read the current hostname)
- sysctl kernel.hostname=NEW_HOSTNAME (to change it)

No comments: