Centos – change hostname

To permanent change your hostname you have to edit the /etc/sysconfig/network file and set the variable HOSTNAME to your needs.

vi /etc/sysconfig/network

give the value you want to HOSTNAME variable like the following example:

HOSTNAME=myhost1.example.com

now this change will take effect after a reboot. There is a way to avoid reboot. You have to run the following command:

echo "myhost1.example.com" > /proc/sys/kernel/hostname

and that’s all!!!

Leave a Reply

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

Prove me that you are not a robot :) * Time limit is exhausted. Please reload the CAPTCHA.