Change Hostname – Changing your hostname inside your server
The hostname on your machine will need to be set correctly. For rDNS requests your hostname must be an FQDN (fully qualified domain name) and have an A record.
To change hostname login as root. We need to edit some files to achieve this. Start by issuing the below command swapping server.yourhostname.com for your hostname
Now let’s edit the network file
NETWORKING=yes HOSTNAME=server.first2hhost.co.uk GATEWAY=213.186.XX.254
Just change the HOSTNAME variable to the hostname you require then save that file.
Inside the host’s file you will see a block of text link this;
127.0.0.1 localhost.localdomain localhost 213.186.XX.XX ns1.first2host.co.uk
Change the last line to the required hostname and make sure the correct IP is listed. This should be your servers IP. Save that file. Reboot your machine and your hostname should now be changed. You can check this by just issuing the hostname command in an ssh console
How was this article?