linux修改主机名
1.查看当前的主机名 [root@localhost datas]# hostname localhost [root@localhost datas]# hostnamectl Static hostname: localhost.localdomain Transient 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.临时修改主机名 [root@localhost datas]# hostname yin 临时修改,重启服务器后就不生效了 [root@localhost datas]# hostname yin [root@localhost datas]# hostname -i 查看本机器名对应的ip地址 fe80::20c