服务器端攻城师 2020-05-15
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 | 
1 2 3 4 5  | [ datas]# hostname yin 临时修改,重启服务器后就不生效了[ datas]# hostnameyin[ datas]# hostname -i 查看本机器名对应的ip地址fe80::20c:29ff:fe5f:6d17%ens33 192.168.75.205 | 
需要修改以下两个配置文件
1 2 3 4 5 6  | 1、方法一使用hostnamectl命令[ ~]# hostnamectl set-hostname xlucas22、方法二:修改配置文件 /etc/hostname 保存退出[ ~]# vi /etc/hostname xlucas2 |