centOs7 更改主机名
centOs7 更改主机名
用了很多方法包括更改host文件都不行
新的改变
[root@192 ~]# hostnamectl
Static hostname: localhost.localdomain
Transient hostname: 192.168.124.46
Icon name: computer-vm
Chassis: vm
Machine ID: c8752287095c4e9db3f9e81b7d30ff0c
Boot ID: dc544210011144bc9c374f9c42605b11
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1160.el7.x86_64
Architecture: x86-64
[root@192 ~]# hostnamectl set-hostname host22
[root@192 ~]# hostnamectl
Static hostname: host22
Icon name: computer-vm
Chassis: vm
Machine ID: c8752287095c4e9db3f9e81b7d30ff0c
Boot ID: dc544210011144bc9c374f9c42605b11
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1160.el7.x86_64
Architecture: x86-64
[root@192 ~]# reboot