
1、使用命令 vim /etc/hostname 修改hostname文件例如将bogon修改为localhost。
2、使用 vim /etc/hosts 修改hosts文件如图将对应的主机名修改为localhost。
3、执行reboot,重启虚拟机,主机名成功修改,如图。
4、可以使用hostnamectl hostnamectl set-hostname hostname(主机名)执行该命令会修改/etc/hostname文件直接修改/etc/hostname文件。
5、执行reboot重启,即可看到主机名更改成功。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)