[CentOS] PXE boot, Kickstart NFS install and %include...

saveline at alinto.net saveline at alinto.net
Thu Mar 23 15:32:54 UTC 2006

> Hi Will,
> I saw your question in the digest version of the list, and thought you
> might be interested in my solution.  I do have it working, and there are
> a couple of points that I didn't see mentioned in the other parts of
> this thread, or just were mentioned in passing.
> The following is a kickstart file for a workstation install on my
> network.
> ********************  Begin example ks file ***************************
> #
> # Custom partitioning and package selection on mirrored 4.5GB SCSI disks
> #
> #
> nfs --server=server --dir=/export/os-cd/centos/4/os 
> # Use NFS installation media
> lang en_US.UTF-8	# Language used during installation process
> langsupport en_US.UTF-8	# Language module(s) to install
> keyboard us		# System keyboard
> text			# Install in text mode
> %include /mnt/ks/centos/4/ks/general-setup
> %include /mnt/ks/centos/4/ks/disp/sun-21-inch
> %include /mnt/ks/centos/4/ks/fw/disabled
> %include /mnt/ks/centos/4/ks/dsk/4gb-scsi-mirror
> %include /mnt/ks/centos/4/ks/pkg/ws
> %include /mnt/ks/centos/4/ks/pkg/cd-burn
> %pre
> #
> #	Mount the KickStart tree
> #
> mkdir /mnt/ks
> mount server:/export/install/rhl/kickstart /mnt/ks
> #
> #	Save DNS config
> #
> cp -p /etc/resolv.conf /tmp
> #
> %include /mnt/ks/centos/4/ks/post-scripts
> %include /mnt/ks/centos/4/ks/boot-mirror-scsi
> ********************  End example ks file *****************************
> ********************  Example disk config module  **********************
> #
> #	Custom partitioning for mirrored 4.5GB SCSI disks
> #
> #Clear the Master Boot Record
> zerombr yes
> #Clear all partitions from the disk
> clearpart --initlabel --all
> part raid.11 --noformat --asprimary --size 2048 --grow --ondisk sda
> part raid.12 --noformat --asprimary --size 256 --ondisk sda
> part raid.13 --noformat --asprimary --size 256 --ondisk sda
> part raid.14 --noformat --asprimary --size 1024 --ondisk sda
> part raid.21 --noformat --asprimary --size 2048 --grow --ondisk sdb
> part raid.22 --noformat --asprimary --size 256 --ondisk sdb
> part raid.23 --noformat --asprimary --size 256 --ondisk sdb
> part raid.24 --noformat --asprimary --size 1024 --ondisk sdb
> raid / --fstype ext3 --level 1 --device md0 raid.11 raid.21
> raid swap --fstype swap --level 1 --device md1 raid.12 raid.22
> raid /var --fstype ext3 --level 1 --device md2 raid.13 raid.23
> raid /tmp --fstype ext3 --level 1 --device md3 raid.14 raid.24
> ******************** End disk config module  **************************
> The first 5 lines seem to be required in all kickstart files, or at
> least I have not been able to do it otherwise.
> The next lines are modules that describe other KS parameters, display
> config, firewall config, disk partitions and mirroring, and lists of
> software groups and/or individual packages to install.
> One VERY IMPORTANT point to remember is shown in the "%pre" script.
> This is how to make the modules available to anaconda for processing.
> Just mount the tree where the modules live somewhere on the target
> system where you can tell anaconda to go read it.  Here, I just create a
> new directory ( /mnt/ks ) and all %include directives reference that
> tree.  Again, all paths must be specified the way that the CLIENT will
> evaluate them.
> After that, it's a snap.  You can do almost anything you want as far as
> including other config files, additional pre/post scripts, whatever.
> The biggest limit I've found so far is the imagination of the person
> setting up the process.

Hi, I am trying to install a box by using your trick (nfs mount + %include)
Here is my problem : Anaconda says that he can't find my files on /mnt/ks
But I think my export should be good because I can mount it on another 
machine. In addition, during the end of anaconda he tells me that he has 
unmounted /mnt/ks and I can see request mount in my /var/log/messages 
You can see my kickstart file :

lang en_US.UTF-8
langsupport --default en_US.UTF-8 en_US.UTF-8 fr_FR.UTF-8
keyboard fr
mouse genericwheelps/2 --device psaux
network --device eth0 --bootproto static --ip --netmask
network --device eth1 --bootproto dhcp
nfs --server my.machine.int --dir /var/kickstart/centos/4.1/i386/os
firewall --disabled
timezone --utc Europe/Paris
bootloader --location=mbr
zerombr yes

%include /mnt/ks/partition
%include /mnt/ks/package

mkdir /mnt/ks
mount my.machine.int:/var/kickstarttest /mnt/ks

%include /mnt/ks/nameserver
%include /mnt/ks/adduser
%include /mnt/ks/partage
%include /mnt/ks/ntp
%include /mnt/ks/yum

cat << EOF2 > /etc/sysconfig/sendmail

chkconfig gpm off
chkconfig kudzu off
chkconfig iptables off
chkconfig ip6tables off
chkconfig mdmonitor off
chkconfig mdmpd off
chkconfig pcmcia off
chkconfig rhnsd off
chkconfig cups off
chkconfig isdn off
chkconfig xfs off
chkconfig ntpd on
chkconfig canna off

cat > /etc/profile.d/toto.sh << EOF5
alias l="ls -la"
alias ppg="ps auxw|grep"
chown root.root /etc/profile.d/toto.sh
chmod 0755 /etc/profile.d/toto.sh

cat >> /etc/inputrc << EOF10
# toto : debut
"\eOC": forward-word
"\eOD": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
# toto : fin

More information about the CentOS mailing list