Ubuntu Server 18.04 更改/etc/hostname已经不能更改hostname了,需要修改以下配置:
修改/etc/cloud/cloud.cfg文件
preserve_hostname: false
修改
preserve_hostname: true
执行命令 hostnamectl set-hostname 主机名
hostnamectl set-hostname testname
重启系统生效
Ubuntu Server 18.04 更改/etc/hostname已经不能更改hostname了,需要修改以下配置:
修改/etc/cloud/cloud.cfg文件
preserve_hostname: false
修改
preserve_hostname: true
执行命令 hostnamectl set-hostname 主机名
hostnamectl set-hostname testname
重启系统生效