You can set host name using nmtui command which has text user interface for new users:
# nmtui
Sample outputs:
Fig.01: Use nmtui to set hostname on a CentOS 7
Use the Down arrow key > select the “Set system hostname” menu option > Press the “Ok” button:
Fig.02: Set hostname
You will see the confirmation box as follows:
Fig.03: New hostname confirmed
Finally, restart hostnamed service by typing the following command
# systemctl restart systemd-hostnamed
To verify changes, enter:
# hostnamectl status
Sample outputs:
Fig.04: CentOS 7 / RHEL View Host Name Details Using hostnamectl Command
บทความจาก cyberciti.biz