Change Debian server hostname

Executing the command hostname newHostName alone, apparently, is not enough.

To change the hostname:

1.  Edit /etc/hostname using your favorite text editor. Mine is vi improved vim.

2.  Change the old host name into the new host name in /etc/hosts.  Usually the second line that states 127.0.0.1 oldHostName

3. Issue the command hostname newHostname

4. Log out and then log back in.  No need to restart.

This also works on Debian-based distributions like Ubuntu and Linux Mint.

Post a comment

You may use the following HTML:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

CAPTCHA