4.1.2 配置主机名称

circle-info

hostname 临时修改主机名;

hostnamectl 永久修改主机名,是对/etc/hostname文件的内容进行修改。

一、使用hostnamectl

1、显示主机名

# hostnamectl

2、设置主机名

# hostnamectl set-hostname linuxdoc.com

3、 刷新主机名

# bash

4、验证

# hostnamectl
# cat /etc/hostname

最后更新于