First modify the Linux server name
In the daily work, if there are a large number of servers, the establishment of easy to remember the machine name, easy to manage daily.
Recommended command rules: Use +IP address after 2 segment
1. Change the network file under/etc/sysconfig, Vi/etc/sysconfig/network, and replace the value after hostname to the hostname you want to set.
2. Change the Hosts file under/etc, vi/etc/hosts, and then replace Localhost.localdomain with the hostname you want to set. After this command goes in, there are multiple names, change the name of the red line below to the name you want, and ensure that the name in step 1 is consistent.
127.0.0.1 localhost Change the name of this location to the name you want localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
3, enter the reboot command, restart the server, restart to take effect.
If it is not convenient to restart, you can use the input command: hostname computer name return (such as hostname Linux) temporary modification, if the configuration file is not changed, the restart is restored to the original, the configuration file will prevail
4, restart the completion of the system with the hostname command to query the host name
This article is from the Linux learning blog, so be sure to keep this source http://12681282.blog.51cto.com/12671282/1904836
Linux Modify machine Name