美文网首页
Ubuntu中修改主机名

Ubuntu中修改主机名

作者: 李必胜 | 来源:发表于2019-01-14 13:56 被阅读0次

显示当前的hostname

hostnamectl

修改hostname

step 1. 使用hostnamectl

hostnamectl set-hostname ubuntu-cosmos

step 2. 修改/etc/hosts

ubuntu@ubuntu-cosmos:~$ cat /etc/hosts

127.0.0.1 localhost

# The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts

127.0.1.1 ubuntu-cosmos ubuntu-cosmos

127.0.1.1 ubuntu-xenial ubuntu-xenial

step 3. 修改/cloud.cfg

ls -l /etc/cloud/cloud.cfg

修改preserve_hostname: true

相关文章

网友评论

      本文标题:Ubuntu中修改主机名

      本文链接:https://www.haomeiwen.com/subject/ijiddqtx.html