一、centos6和7临时修改
[root@centos6 ~]# hostname 132
[root@centos6 ~]# hostname
132
二、永久修改
1、centos6
[root@centos6 ~] # vim /etc/sysconfig/network
2、centos7
[root@centos7 ~] # hostnamectl set-hostname centos7
或者
[root@centos7 ~] # vim /etc/hostname
[root@centos7 ~] # exec bash