Show Table of Contents
3.4. 使用 nmcli 配置主机名
可使用 NetworkManager 工具 nmcli 查询和设定
/etc/hostname 文件中的主机名。注:写入时,hostnamectl 不会意识到采用这个方法更改的主机名。
请运行下面的命令查询 static 主机名:
~]$ nmcli general hostname
请作为 root 用户运行下面的命令将 static 主机名设定为 my-server:
~]# nmcli general hostname my-server
要强制 hostnamectl 注意这个 static 主机名更改,请作为 root 用户重启 hostnamed:
~]# systemctl restart systemd-hostnamed

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.