下面举例说明,将hostname改为 www.ctohome.com,
如何修改linux/centos的hostname(主机名):
第一步:
#hostname www.ctohome.com
第二步:
修改/etc/sysconfig/network中的hostname
vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
#HOSTNAME=localhost.localdomain
HOSTNAME=www.ctohome.com
~
第三步:
修改/etc/hosts文件
vi /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost www.ctohome.com
::1 localhost6.localdomain6 localhost6