Linux:修改主机名【Centos7】

有时候看着主机名糟心吧,怎么就没有想起来改呢?默认的太难看了,换个能表意的主机名呗

1、看一下主机名状态

hostnamectl status 结果如下:

Static hostname: localhost.localdomain
         Icon name: computer
           Chassis: n/a
        Machine ID: 0d63496b796044cd9e39cd4e29f5895c
           Boot ID: 77a3fb45fb4b428aaec0390f58c308ab
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64

2、改一下主机名

hostnamectl set-hostname hadoop1

3、再看一下主机名的状态

hostnamectl status

结果如下:已经改成我们想要的hadoop1了

Static hostname: hadoop1
         Icon name: computer
           Chassis: n/a
        Machine ID: 0d63496b796044cd9e39cd4e29f5895c
           Boot ID: 77a3fb45fb4b428aaec0390f58c308ab
    Virtualization: vmware
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-123.el7.x86_64
      Architecture: x86_64

你可能感兴趣的:(hostname,主机名)