zoukankan      html  css  js  c++  java
  • centos7修改主机名

    centos修改主机名

    1、临时修改,重启失效

    [root@centos17 ~]# hostname abc
    [root@centos17 ~]# hostname
    abc
    

      

    2、永久修改,修改配置文件,重启生效

    [root@centos17 ~]# cat /etc/hostname
    centos17
    

    linux7.4使用系统自带的命令hostnamectl修改主机名,永久生效

    [root@xxx ~]# cat /etc/hostname 
    x160
    [root@xxx ~]# hostnamectl set-hostname xxx
    [root@xxx ~]# cat /etc/hostname 
    xxx
    [root@xxx ~]# hostname
    xxx
    

      

    修改主机hosts文件,用域名替代ip

    [root@centos17 ~]# cat /etc/hosts
    127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
    [root@centos17 ~]# 
    

      

  • 相关阅读:
    rpc
    route
    ROLLBACK
    rmdir -删除空目录
    rm
    rlogin
    REVOKE
    resolver
    RESET
    repquota
  • 原文地址:https://www.cnblogs.com/xiaofeng666/p/13212675.html
Copyright © 2011-2022 走看看