通過修改配置文件修改主機(jī)名
打開配置文件癣缅,直接將里面的內(nèi)容改為新的主機(jī)名卖鲤,然后重啟電腦
vim /etc/hostname
使用指令修改主機(jī)名
使用hostnamectl
命令查看主機(jī)信息
[root@centos ~]# hostnamectl
Static hostname: linux
Icon name: computer-vm
Chassis: vm
Machine ID: b559d1b291314f46a70cd27626e07585
Boot ID: 4ef2139b723748169b56a1c2f2886f66
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-1160.el7.x86_64
Architecture: x86-64
使用hostnamectl set-hostname linux
將主機(jī)名設(shè)置為”linux“
[root@centos ~]# hostnamectl set-hostname linux