自动生成的/ etc / hosts是错误的

我创build了一个kickstart脚本,以完全自动化的方式安装CentOS 5.5(32位)。

DNS / DHCP设置正确地为正向和反向查找提供了正确的主机名。

挖node4.mydomain.com。 +短

10.10.10.64 

dig -x 10.10.10.64 + short

 node4.mydomain.com. 

在安装完成后的状态下安装的系统如下:

猫/ etc / sysconfig /networking

 NETWORKING=yes NETWORKING_IPV6=yes GATEWAY=10.10.10.1 HOSTNAME=node4.mydomain.com 

echo $ {HOSTNAME}

 node4.mydomain.com 

猫/ etc / hosts

 # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 10.10.10.64 node4 

我的问题是,这个自动生成的主机文件与我想要的方式有些不同(或者更好:Hadoop希望的方式)。

最后一行应该是这样的:

 10.10.10.64 node4.mydomain.com node4 

我该怎么修改在哪里解决这个问题?

谢谢。


编辑:我试图find实际创build此文件的代码。 我看了一下acaconda的源代码和安装src rpm,但是没有完成。 有没有人知道创build/ etc / hosts文件的位置在哪里?


我将以下内容添加到了我的kickstart文件的%post中:

 # ========================= # Force the right hosts file for Hadoop and such cat > /etc/hosts <<End-of-file # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 \$(dig +short \$(hostname)) \$(hostname -f) \$(hostname -s) End-of-file 

不熟悉RedHat的kickstart系统,我会使用补充脚本在安装结束时运行,并按照您的需要设置线路。