Random Linux

Linux, video games and web hosting

To change the hostname in CentOS, you will first need to update the hostname line in the /etc/sysconfig/network file.


Once that is changed, you will want to add the IP address for the hostname to /etc/hosts. localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6 example.randomlinux.com

Then, you need to restart network for the changes to take affect.

service networking restart
/etc/init.d/network restart

Once that is done, you should be able to use the hostname command and it should show the new hostname that you set. On my test box I did have to restart the box for it to take affect, so if you don’t see the changes, you may need to reboot.

[[email protected] ~]# hostname

September 20th, 2013

Posted In: How To

Tags: ,

Leave a Reply

Your email address will not be published. Required fields are marked *