Change Hostname – Changing your hostname inside your server

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

hostname server.yourhostname.com

Now let’s edit the network file

nano /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=server.first2hhost.co.uk
GATEWAY=213.186.XX.254

Cheap Dedicated Server Hosting

Just change the HOSTNAME variable to the hostname you require then save that file.

/etc/hosts file

nano /etc/hosts

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

hostname

How was this article?

Change Hostname – Changing your hostname inside your server
18 5 100%

Dedicated Servers VPS Servers

Select Language
We are currently updating our website. Please accept our apologies for any disruption you may see.
+