centos7 更换主机名

tech2022-07-16  182

刚装了centos7集群机器,想把主机名统一换成bigdata1、bigdata2……

1.查看当前主机名

[root@localhost ~]# hostnamectl Static hostname: localhost.localdomain Icon name: computer-server Chassis: server Machine ID: b398178be14e44da8a010a943386a0ef Boot ID: 35dd2d3900b84001b69665e30315167d Operating System: CentOS Linux 7 (Core) CPE OS Name: cpe:/o:centos:centos:7 Kernel: Linux 3.10.0-514.el7.x86_64 Architecture: x86-64

2.更换主机名

[root@localhost ~]# hostnamectl set-hostname bigdata0

3.重启

发现主机名由localhost变成了bigdata0

最新回复(0)