This article will cover a simple server hostname change in CentOS. By default your server will be kicked with the server's given name as the hostname. Some software such as CPanel require a valid Fully Qualified Domain Name or FQDN for the hostname to be used during their Licensing verification system.
Contents |
There are 4 steps in a hostname change, luckily all the steps are easy.
Open the /etc/sysconfig/network file with your favorite text editor. Modify the HOSTNAME= value to match your FQDN host name.
# sudo nano /etc/sysconfig/network
HOSTNAME=myserver.domain.com
Change the host that is associated to your main IPaddress for your server, this is for internal networking (found at /etc/hosts):

The 'hostname' command will let you change the hostname on the server that the commandline remembers, but it will not actively update all programs that are running under the old hostname.

At this point all the necessary changes that needed to be made have been made, you will want to restart networking on your server to make sure that changes will be persistent on reboot:
# /etc/init.d/network restart
© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License

4 Comments
CNAME Record
re: CNAME
If you do want to use a domain name as your hostname, and access it from other machines, you'll usually want to set it up in DNS as either an A or CNAME record. But if you have the hostname in your /etc/hosts file associated with an IP address, the server will always associate the hostname with an address with or without a corresponding DNS record.
Rackspace cloud servers are
Thanks for your Replay Jared!
re: Virtual servers
What sort of configuration were you looking to do?
Add new comment