显示当前主机名
hostnamectl
更改系统主机名
sudo hostnamectl set-hostname k8s-note2
静态主机名(hostname)存储在中/etc/hostname
主机名(hostname)映射
在大多数系统上,主机名(hostname)映射到127.0.0.1
中/etc/hosts
。打开文件,将旧的主机名(hostname)更改为新的主机名(hostname)。
生效
service network-manager restart
# 重启网络
systemctl network restart