Difference between revisions of "How to change the Hostname on Centos"
(Created page with "==How to change/adjust the Hostname on Centos== ===Changing your Hostname on Centos=== I just got a new vps server and the host name was something really shitty like vps2230...") |
(No difference)
|
Revision as of 06:32, 7 December 2013
Contents
How to change/adjust the Hostname on Centos
Changing your Hostname on Centos
I just got a new vps server and the host name was something really shitty like vps22303_001 and I wanted to change the host name. In order to change your host name you have to chage the HOSTNAME in your /etc/sysconfig/network file
vim /etc/sysconfig/network
Now change the HOSTNAME value to your FQDN, it should look like
HOSTNAME=mail.briansnelson.com
As this was my mail server, that is the FQDN for that server.
Now this hostname will not update until you have rebooted the server.
reboot
How to temporarily change your hostname
Not sure why any one would want to change the hostname temporarily, but you can do this with the hostname command
hostname mail.briansnelsons.com
To verify that it has changed or view your current hostname run
hostname
This will show you the current hostname on your server/workstation
Now if you use hostname to change your HOSTNAME, once you reboot it will change to the old value
Add your FQDN to your hosts file
Now that you have changed your hostname, you will also want to update your /etc/hosts file.
echo '127.0.0.1 mail.briansnelson.com' >> /etc/hosts
Now to check the /etc/hosts file to make sure it was added correctly
cat /etc/hosts
Now your server is ready to know was your FQDN