CentOS Server installed, the default host name is: Localhost.localdomain, in order to and management, we need to modify the server host name, this modification takes effect on two profiles/etc/sysconfig/network and etc /hosts, here's how to do it:
[Root@localhost ~]# Vi/etc/sysconfig/network
Networking=yes
Hostname=localhost.localdomain
gateway=192.168.1.1
Modified to:
[Root@localhost ~]# Cat/etc/sysconfig/network
Networking=yes
Hostname=ithov.com&http://www.aliyun.com/zixun/aggregation/37954.html ">NBSP; #此处HOSTNAME即为你需要修改的主机名
gateway=192.168.1.1
[Root@localhost ~]# vi/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
After we open the Hosts file, we modify it,
Where 127.0.0.1 is the local loop address, Localhost.localdomain is the host name (hostname), which is what you want to modify. LocalHost is the alias of the host name (alias), which appears under the Konsole prompt. Change the second item to your host name and the third option.
[Root@localhost ~]# cat/etc/hosts
127.0.0.1 localhost ithov.com localhost4 localhost4.localdomain4
:: 1 localhost ithov.com localhost6 localhost6.localdomain6
Restart the computer to take effect
[Root@localhost ~]# reboot
The host name has been modified successfully after landing:
Last login:wed June 4 23:51:33 2014 from 192.168.1.3
[Root@ithov ~]#
[Root@ithov ~]# Uname-n
Ithov.com