This is for those who want to set up a hostname on their VPS or Dedicated Server. The Hostname should be FQDN- Fully Qualified Domain Name. The hostname is your server’s name that you want to set. Always set the hostname with the domain name that you own. Follow these steps:-

a.http://IP/whm edit dns zone .. select your domain

server IN A YourSeverIPHere
www.server IN A YourSeverIPHere
OR
if you are using shell then you can simply append following lines there in
# vi /var/named/domain.com.db

server IN A YourSeverIPHere
www.server IN A YourSeverIPHere

Save the file
#service named reload
#rndc reload domain.com

b.WHM >> Basic cPanel/WHM Setup >> Hostname

or
Login to shell /server as a root and fire this command the second parameter will the hostname that you want to set.
hostname server.domain.com

c.Check /etc/hosts file that it is set properly.

You need to add there

87.117.200.71(ex.IP) server.mydomain.com server

server.mydomain.com is the hostname for this VPS then must add above live there, modify there as per your requirement.

Just confirm that you have set that properly because changing the hostname will affect few services on your server if you have not done that properly or have done any spelling mistake while setting hostname of your server.

d.Fire hostname on your server if it shows the hostname then you have set it properly. Its done now.

by hostingcomments.com