Copyright statement: This article is an original article of hard work, and all major self-media platforms are updated simultaneously. Welcome to reprint, please indicate the source, thank you
The name of my previous blog was Dianchi Guhong, which was later changed to the current name. The host name of the machine I use for experimentation will also be changed. The host name was DCGH before, but now the host name is ChatDevOps. Changed this morning After finishing the hostname, I found that the pretty hostname always exists, even after logging out or restarting.
[ root@ChatDevOps ~]# hostnamectl
Static hostname: ChatDevOps
Pretty hostname: DCGH
Icon name: computer-vm
Chassis: vm
Machine ID: 266d7690f650a21312d325235ad7f7a7
Boot ID: 97b7b37fa5ea4b2582006e8ca15d2242
Virtualization: kvm
Operating System: CentOS Linux 7(Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.17.1.el7.x86_64
Architecture: x86-64
Later, I looked at the official documents of Redhat. The specific hostname in CentOS7 can be cleared. The specific commands are as follows:
[ root@ChatDevOps ~]# hostnamectl set-hostname ""--pretty
Look again to see if the removal is successful:
[ root@ChatDevOps ~]# hostnamectl
Static hostname: ChatDevOps
Icon name: computer-vm
Chassis: vm
Machine ID: 266d7690f650a21312d325235ad7f7a7
Boot ID: 97b7b37fa5ea4b2582006e8ca15d2242
Virtualization: kvm
Operating System: CentOS Linux 7(Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.17.1.el7.x86_64
Architecture: x86-64
The complete command format is like this:
# hostnamectl set-hostname ""[option...]
Where "" is a bracketed blank string, option is one or more of pretty, static and transient.
Recommended Posts