大漠駝鈴

          置身浩瀚的沙漠,方向最為重要,希望此blog能向大漠駝鈴一樣,給我方向和指引。
          Java,Php,Shell,Python,服務(wù)器運(yùn)維,大數(shù)據(jù),SEO, 網(wǎng)站開(kāi)發(fā)、運(yùn)維,云服務(wù)技術(shù)支持,IM服務(wù)供應(yīng)商, FreeSwitch搭建,技術(shù)支持等. 技術(shù)討論QQ群:428622099
          隨筆 - 238, 文章 - 3, 評(píng)論 - 117, 引用 - 0
          數(shù)據(jù)加載中……

          CentOS7 修改Hostname

          最近想修改Centos7的hostname, 可是如果直接修改hostname文件不生效,今天查了查原來(lái)centos有幾種hostname.

           hostnamectl  控制整個(gè)系統(tǒng)的hostname,推薦使用
          nmtul             使用text ui 控制 
          nmtcli            可以用但是不推薦使用

          [root@willweb ~]# hostnamectl status
             Static hostname: willweb
                   Icon name: computer-vm
                     Chassis: vm
                  Machine ID: f9d400c5e1e8c3a8209e990d887d4ac1
                     Boot ID: dd7be45d652849dcb82493c286c69dbf
              Virtualization: kvm
            Operating System: CentOS Linux 7 (Core)
                 CPE OS Name: cpe:/o:centos:centos:7
                      Kernel: Linux 3.10.0-327.el7.x86_64
                Architecture: x86-64
          [root@willweb ~]# hostname
          willweb
          [root@willweb ~]# hostnamectl
             Static hostname: willweb
                   Icon name: computer-vm
                     Chassis: vm
                  Machine ID: f9d400c5e1e8c3a8209e990d887d4ac1
                     Boot ID: dd7be45d652849dcb82493c286c69dbf
              Virtualization: kvm
            Operating System: CentOS Linux 7 (Core)
                 CPE OS Name: cpe:/o:centos:centos:7
                      Kernel: Linux 3.10.0-327.el7.x86_64
                Architecture: x86-64
          [root@willweb ~]# hostnamectl status
             Static hostname: willweb
                   Icon name: computer-vm
                     Chassis: vm
                  Machine ID: f9d400c5e1e8c3a8209e990d887d4ac1
                     Boot ID: dd7be45d652849dcb82493c286c69dbf
              Virtualization: kvm
            Operating System: CentOS Linux 7 (Core)
                 CPE OS Name: cpe:/o:centos:centos:7
                      Kernel: Linux 3.10.0-327.el7.x86_64
                Architecture: x86-64
          使用命令如下
          # hostnamectl set-hostname Your-New-Host-Name-Here
          # hostnamectl set-hostname "Your New Host Name Here" --pretty
          # hostnamectl set-hostname Your-New-Host-Name-Here --static
          # hostnamectl set-hostname Your-New-Host-Name-Here --transient
          遠(yuǎn)程設(shè)置hostname
          ssh root@server-ip-here hostnamectl set-hostname server1
          hostnamectl set-hostname server1 -H root@192.168.1.42





          posted on 2016-11-10 09:52 草原上的駱駝 閱讀(2818) 評(píng)論(0)  編輯  收藏 所屬分類(lèi): Linux

          主站蜘蛛池模板: 荣成市| 东港市| 富宁县| 晋中市| 翁牛特旗| 普洱| 安化县| 丘北县| 吉木萨尔县| 荣昌县| 右玉县| 静海县| 扎赉特旗| 华宁县| 墨玉县| 峨山| 兴海县| 武隆县| 淅川县| 蒙山县| 澄迈县| 鹰潭市| 奉贤区| 称多县| 隆安县| 永修县| 盐池县| 许昌市| 汽车| 阿克苏市| 新龙县| 乐平市| 沐川县| 额尔古纳市| 彩票| 舞阳县| 西安市| 娱乐| 湘潭县| 杭锦旗| 仙游县|