centos hostname code example
Example 1: set hostname centos 7
hostnamectl set-hostname <mention the host name>
Example 2: centos change hostname
# hostnamectl set-hostname your-new-hostname
hostnamectl set-hostname <mention the host name>
# hostnamectl set-hostname your-new-hostname