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