1 、临时生效(使用centos5,6,7版本)

hostname 修改的计算机名称

[root@localhost ~]# hostname centos
[root@localhost ~]# hostname
centos

[root@centos ~]# hostname
centos

2 永久修改

centos 7.x

[root@localhost ~]# vi /etc/hostname
centos

centos 6.x

[root@centos ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos
[root@centos ~]# hostname
centos

Comments are closed.

Post Navigation