To permanent change your hostname you have to edit the
/etc/sysconfig/network file and set the variable
HOSTNAME to your needs.
give the value you want to
HOSTNAME variable like the following example:
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!!!