At the Linux command line, enter hostname, view the current hostname, and if you want to modify it, add a new host name directly after hostname (note: The following actions require root user execution), such as:
# hostname Newhostname
Note, however, that the above hostname command only temporarily modifies the hostname and fails after reboot. If you want to permanently change the host name, you must edit the following file:
Vi/etc/sysconfig/network
Hostname=yournewhostname
After this operation, the new hostname remains in effect even after the reboot.
Finally, after the host name has been modified, remember to configure the new hostname and IP match in the/etc/hosts file, such as:
Vi/etc/hosts
192.168.1.16 hostname Alias
The first field is an IP address, the second is a formal hostname (returned by the hostname command), and the other fields are aliases
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Servers/web/