There are two methods to modify the host name in Linux: 1. Use the hostname command method: [root @ hening ~] # Hostname ABC [root @ hening ~] # Su [root @ ABC ~] # do not use this command to modify the host name. It is valid only for the current shell and will expire if the system is restarted. 2. modify the configuration file of the Linux host. method: modify the configuration file/etc/sysconfig/network and/etc/hosts 1. first, modify the host name in/etc/sysconfig/network. # vi/etc/sysconfig/Network networking = Yes hostname = HCN // modify hostname here nisdomain = eng-cn.platform.com 2. modify the name in/etc/hosts # vi/etc/hosts 127.0.0.1 localhost. localdomain localhost 172.17.33.169 HCN // modify the hostname here 3. run the following command on the terminal: # hostname HCN # su |
I used to modify the name in/etc/hosts. You can modify the name.