centos 7修改方式:

hostnamectl  set-hostname   hostuser

reboot 

或者直接vi /etc/hostname

添加内容:

hostuser

 

 检查修改效果

[chenquan@hostuser ~]$ hostname
hostuser
[chenquan@hostuser ~]$ cat /etc/hostname
hostuser
[chenquan@hostuser ~]$