Ubuntu 18.04通过文件*/etc/hostname*修改主机名后,重启失败该怎么解决?
- 首先修改*/etc/cloud/cloud.cfg文件中的preserve_hostname*属性,改为
true
。
vim /etc/cloud/cloud.cfg
-- 修改属性
preserve_hostname: true
- 修改
/etc/hostname
文件中的文件名
vim /etc/hostname
-- 修改系统名为你想要的系统名
hostname
-
重启系统
reboot
-
查看主机名
hostname