Changing the hostname in redhat and centos 7 has changed since versions 5 and 6. To do it now you will have to use the “nmtui” command, which is a text user interface for modifying network parameters.
Select “Set system hostname” and you will be prompted with a screen to set it.
Now you can verify in /etc/sysconfig/network to make sure it is set correctly
Try not to modify the file directly, use the nmtui command as a best practice.