Linux修改主机名
1.查看当前的主机名
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | [ datas]# hostnamelocalhost[ datas]# hostnamectl   Static hostname: localhost.localdomainTransient hostname: localhost         Icon name: computer-vm           Chassis: vm        Machine ID: f1d9ecb6c6bd4e02b58e19bba402056c           Boot ID: 91603e0798814b54a928e70fd2a2754f    Virtualization: vmware  Operating System: CentOS Linux 7 (Core)       CPE OS Name: cpe:/o:centos:centos:7            Kernel: Linux 3.10.0-693.el7.x86_64      Architecture: x86-64 | 
2.临时修改主机名
| 1 2 3 4 5 | [ datas]# hostname yin 临时修改,重启服务器后就不生效了[ datas]# hostnameyin[ datas]# hostname -i 查看本机器名对应的ip地址fe80::20c:29ff:fe5f:6d17%ens33 192.168.75.205 | 
3.永久修改主机名
需要修改以下两个配置文件
| 1 2 3 4 5 6 | 1、方法一使用hostnamectl命令[ ~]# hostnamectl set-hostname xlucas22、方法二:修改配置文件 /etc/hostname 保存退出[ ~]# vi /etc/hostname xlucas2 | 
相关推荐
  amethystqi    2020-05-19  
   书虫媛    2020-03-07  
   GQ00    2020-01-14  
   wannagonna    2020-01-10  
   wqx    2013-08-07  
   Antech    2019-12-15  
   xinlugang    2019-12-04  
   FruitDrop    2015-06-08  
   82500496    2010-10-03  
   Vi    2019-09-19  
   阿左的小站    2019-09-08  
   dongfangxiaozi    2019-08-12  
   boxue    2019-08-06  
   HJYLilyth    2019-04-11  
 