Linux change hostname

Modify the hostname on Linux:
1. First, change the configuration file (it will take effect after restarting)
vi /etc/sysconfig/network hostname=modified hostname
2. Change the current hostname to
hostname Modified host Name (currently valid, invalid after restarting) (The host name modification has been successfully completed through the above two steps, and it will not be invalid after restarting, because we have made changes in the configuration file)
3. Modify the hosts file (so that the system does not recognize it ) This hostname)
vi /etc/hosts Add the new hostname to the line 127.0.0.1, or change the old hostname to the new hostname

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326802564&siteId=291194637