How to change the hostname of your VPS
Many times the default or first-choice hostname of your VPS doesn’t please you any more. Changing the hostname is easy if you have ssh access, by following these steps:
Edit your server’s /etc/sysconfig/network file with your preferred text editor (in this case, nano).
[root@vps ~]# nano /etc/sysconfig/network
Find the line containing “HOSTNAME=” and add your FQDN hostname.
HOSTNAME=mynode.domain.com
If you utilize internal networking, also change the host associated with the main IP address of your VPS.
[root@vps ~]# nano /etc/hosts
127.0.0.1 localhost localhost.localdomain
123.45.67.89 hostname.domain.com hostname
~
~
-- INSERT -- 2,43-57 ALL
Run “hostname” commad, followed by your preferred FQDN hostname:
[root@vps ~]# hostname mynode.domain.com
[root@vps ~]# hostname
mynode.domain.com
[root@vps ~]#
4. Don’t forget to also restart your network service, for the changes to persist on restart
/etc/init.d/network restart
And that’s it! You now have a new hostname for your DS/VPS !