How to change the servers hostname

July 26, 2008 · Filed Under Linux Tutorials · Comment 

When your datacentre has setup your dedicated server, they may setup a custom hostname of their own, or they may have setup a hostname you requested when they installed the operating system.

In order to change the hostname you’ll need to do the following:

  1. Type nano /etc/sysconfig/network
  2. Edit the configuration file so that you change the hostname to the one you want. The part you need to change is this: HOSTNAME="sub.name.com", it won’t look exactly like that, but it will start with HOSTNAME="something.name.com", just simply change that, press CTRL+X so that you save and exit the configuration file.
  3. You will need to replace every occurrence of your old hostname in /etc/hosts.
  4. Reboot your server.

Once your server has successfully rebooted, your new hostname should now work. You may need to contact your DC to setup a Reverse DNS entry for your new hostname if you wish to send emails from this server.

When wanting to find the best deal for something, then comparison is a must. Whilst it's very important to compare home insurance and things like that, it's also a good idea not to forget smaller - but still essential - things like pet insurance comparison as well as broadband comparison.