menu Chancel's Blog
rss_feed lightbulb_outline

Ubuntu1804修改主机名

类型:Linux
创建时间:2021-06-16 10:44:19
更新时间:2021-06-16 10:44:19
类型:Linux
更新时间:2021-06-16 10:44:19

对于Ubuntu1404后的Ubuntu系统,修改主机名无需再修改多处系统配置并重启系统

借助hostnamectl命令我们可以很方便的修改主机名且无需重启

查看主机名

ubuntu@my-machine:~$ hostnamectl status
   Static hostname: my-machine
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 6ffef97fac51426e8e6741b4f8eb59eb
           Boot ID: 6565db91b77645ec8ca7ea502819c547
    Virtualization: kvm
  Operating System: Ubuntu 18.04.4 LTS
            Kernel: Linux 4.15.0-143-generic
      Architecture: x86-64

修改主机名

ubuntu@my-machine:~$ sudo hostnamectl set-hostname my-machine-new

再次查看主机名

ubuntu@my-machine:~$ hostnamectl status
   Static hostname: my-machine-new
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 6ffef97fac51426e8e6741b4f8eb59eb
           Boot ID: 6565db91b77645ec8ca7ea502819c547
    Virtualization: kvm
  Operating System: Ubuntu 18.04.4 LTS
            Kernel: Linux 4.15.0-143-generic
      Architecture: x86-64

[[replyMessage== null?"发表评论":"@" + replyMessage.m_author]]

account_circle
email
web_asset
textsms

评论列表([[messageList.data.items.length]])

[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[messageItem.m_environ.browser]] [[messageItem.m_environ.os]] [[messageItem.m_environ.device]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[subMessage.m_environ.browser]] [[subMessage.m_environ.os]] [[subMessage.m_environ.device]]