Centos7 Three ways to change the hostname hostname

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

Method 1 hostnamectl modified

Step1 views the host name

hostname

Step2 modifies the host name

Order form

hostnamectl set-hostname Hostname

Modify the

hostnamectl set-hostname Master

Step3 looks at the host name again

hostname

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

Slave01

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

10.238.162.33 Slave01

Restart reboot in effect

Method 3 temporarily modifies the host name

hostname Slave01

conclusion


Related articles: