2

I've created a kickstart script to install CentOS 5.5 (32bit) in a fully automated way.

The DNS/DHCP setup correctly gives the system the right hostname in both the forward and reverse lookups.

dig node4.mydomain.com. +short

10.10.10.64

dig -x 10.10.10.64 +short

node4.mydomain.com.

In the state the installed system is right after the installation completed is as follows:

cat /etc/sysconfig/network

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

echo ${HOSTNAME}

node4.mydomain.com

cat /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

My problem is that this automatically generated hosts file is slightly different from the way I want it (or better: the way Hadoop wants it).

The last line should look like this:

10.10.10.64            node4.mydomain.com node4

What do I modify where to fix this?

Thanks.


Edit: I've tried to find the code that actually creates this file. I've had a look inside the acaconda sources and the setup src rpm but it wasn't done from one of those. Does anyone here know where to code is located that creates the /etc/hosts file?


I added the following to the %post of my kickstart file which works for my situation:

# =========================
# 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
2
  • Check that the DHCP server is actually returning a Domain Name (option 15). I do the same setup and /etc/hosts is formatted correctly. Feb 3, 2011 at 17:23
  • @embobo: I'm using dnsmasq for this setup: What's the best way to check that the DHCP server really does this correctly? Feb 3, 2011 at 20:36

1 Answer 1

2

Not being familiar with RedHat's kickstart system, I would use a supplemental script to run at the end of installation and set the line the way you want.

1
  • Thanks, see the bottom of my question on how I actually did it. Feb 7, 2011 at 14:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .