美文网首页工作生活
Unbuntu 18 修改主机名

Unbuntu 18 修改主机名

作者: 索伦x | 来源:发表于2019-07-03 13:19 被阅读0次

    sudo nano /etc/hostname修改需要的主机名。

    1. #vim /etc/cloud/cloud.cfg
      将preserve_hostname: false修改为true

    2. # vim /etc/hostname
      Your new Hostname

    3. # sudo reboot

    修改示例

    root@k8s-master:~# cat /etc/hostname
    k8s-master
    root@k8s-master:~# cat /etc/cloud/cloud.cfg
    # The top level settings are used as module
    # and system configuration.
    
    # A set of users which may be applied and/or used by various modules
    # when a 'default' entry is found it will reference the 'default_user'
    # from the distro configuration specified below
    users:
       - default
    
    # If this is set, 'root' will not be able to ssh in and they
    # will get a message to login instead as the default $user
    disable_root: true
    
    # This will cause the set+update hostname module to not operate (if true)
    preserve_hostname: true
    
    

    相关文章

      网友评论

        本文标题:Unbuntu 18 修改主机名

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