Centos7中提供了设置主机名的工具 hostnamectl
hostname有三种状态 static(永久) transient(瞬态) pretty (灵活)
查看主机名状态
[oracle@hadoop ~]$ hostnamectl status
Static hostname: hadoop
Icon name: computer-vm
Chassis: vm
Machine ID: 52f2b03b2afb46be8b195895d9025dd3
Boot ID: e948f0f5e7524fb38c56f36dfbe4abb7
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-514.2.2.el7.x86_64
Architecture: x86-64
设置主机名为centos7(瞬态)
[oracle@hadoop ~]$ hostnamectl --transient set-hostname centos7
设置主机名为centos7(永久)
[oracle@hadoop ~]$ hostnamectl --static set-hostname centos7
本文介绍了在Centos7系统中使用hostnamectl工具设置主机名的方法,并解释了静态(static)、瞬态(transient)和灵活(pretty)三种主机名状态的区别。
263

被折叠的 条评论
为什么被折叠?



