centos7 modify hostname (hostname)

     In some applications of linux, the host name will be embedded in the configuration file as a variable, otherwise an error will be reported. The variable name is $HOSTNAME. In the version before centos7, it can take effect by modifying the two files /etc/sysconfig/network and /etc/hosts, but recently a server has installed the centos7 version. According to the above steps, no matter how you do it, it will not take effect. less time.

       By checking the information, it is found that the centos7 version has changed the configuration file for reading the host name. This configuration file is in /etc/hostname. And this file is no longer a key-value pair, just add a line of hostname.

 

After setting, reboot the machine to take effect.

Guess you like

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