Linux Hostname
Each distribution has a script that runs at boot time which sets the hostname. The way to change the hostname permanently thus differs by distribution.
-
Debian has an init script, /etc/init.d/hostname.sh, which is called at boot time and sets the hostname what is given in /etc/hostname. To change the hostname, place onlythe unqualified hostname (e.g., gauss) in /etc/hostname and run sudo /etc/init.d/hostname.sh.
-
Ubuntu, like Debian, also uses /etc/hostname, but to update the hostname after making a change, run sudo service hostname start.
-
Red Hat/Centso/Fedora systems look for a line like
HOSTNAME=gauss
in /etc/sysconfig/network. To make the change immediate you also need to runhostname gauss as root or simply reboot.