To change hostname permanently in CentOS, use the following hostnamectl command (not hostname).
hostnamectl set-hostname myhostname --static
To change hostname permanently in CentOS, use the following hostnamectl command (not hostname).
hostnamectl set-hostname myhostname --static