skip navigation

www.Hilands.com


Content:: Change Host Name

Changing your computers host name
OS: Debian
Last Modified: 2012-06-06
There are two locations we need to change the "host name" in debian. One will cover the locations for the operating system and the other will change the host settings for the network interface.

Table of Contents
System Host Name
The first location is going to be the hostname file in /etc/. This is a simple one line file for the host name. Change the text in the file to your new host name.

First we'll make a copy of the file. # cp /etc/hostname /etc/hostname.org
Open the file in your favorite editor. # nano /etc/hostname

Next we'll run the startup hostname script. This may make cause some problems with your system. I'd recommend saving any documents and information and prepare for a system restart # /etc/init.d/hostname.sh
Network Host Name
First we'll make a copy of our hosts file # cp /etc/hosts /etc/hosts.orig
Next we'll edit the host file, this file is slightly different and may vary from our example. # nano /etc/hosts
127.0.0.1  localhost
127.0.1.1  <hostname>.example.com  <hostname>

At this point I would recommend restarting your system.
References