查看当前主机名

1
hostname

以下操作管理员身份运行

修改主机名

1
vim /etc/hostname

修改 hosts 文件(为了解析新的主机名)

1
vim /etc/hosts

重启,问题解决

1
reboot