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.

Filed under: Debian, Linux

No comment yet, add your voice below!


Add a Comment

Your email address will not be published. Required fields are marked *

Comment *
Name *
Email *
Website

CAPTCHA


This site uses Akismet to reduce spam. Learn how your comment data is processed.