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:
- Type nano /etc/sysconfig/network
- 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.
- You will need to replace every occurrence of your old hostname in /etc/hosts.
- 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.


