Centos7 Three ways to change the hostname hostname

  • 2020-12-26 06:17:56
  • OfStack

Method 1 hostnamectl modified

Step1 views the host name


Step2 modifies the host name

Order form

hostnamectl set-hostname Hostname

Modify the

hostnamectl set-hostname Master

Step3 looks at the host name again


A new meeting call changes to a new host name without a reboot

Method 2 by modifying the file

Modify the file

vi /etc/hostname add the host name


vi /etc/sysconfig/network Add correspondence between IP and hostname Slave01

Restart reboot in effect

Method 3 temporarily modifies the host name

hostname Slave01


Related articles: