Mike的分享空间
date: 2021.01.29; modification:2021.01.29
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