modified hostname in redhat

来源:互联网 发布:linux下配置php环境 编辑:程序博客网 时间:2024/06/14 07:18

1,修改/etc/hosts,

格式:vi hostname

我在下面加上一条:192.168.2.105    beke.infosys  beke

重启后,使用命令hostname查看hostname由localhost.localdomain变成了beke.infosys

但启动过程中显示hostname仍为localhost.localdomain

2,我又修改了/etc/sysconfig/network,

HOSTNAME=beke.infosys

再次重启启动过程中显示如下:

3,启动脚本是/etc/rc.d/rc.sysinit,其实hostname的配置文件是/etc/sysconfig/network,在启动脚本中有判断语句,

在一定条件下,会从/etc/hosts中读取hostname。

 

/etc/sysconfig/network
/etc/hosts
/etc/rc.d/rc.sysinit