How to change server hostname in CentOS 7

Modify the hostname under CentOS7

The first : hostname hostname

01.hostname hostname In

this way, only the temporary hostname can be modified. When the machine is restarted, the hostname changes back.

The second: hostnamectl set-hostname <hostname>

in the command line, enter

01.hostnamectl set-hostname <hostname>

Use this method to modify, you can permanently modify the host name!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326484690&siteId=291194637