CentOS change hostname without reboot

you can do it in 2 steps:

vim /etc/sysconfig/network

change the HOSTNAME to your preferred servername
save and exit

then

echo “newhostname” > /proc/sys/kernel/hostname