Will McDonald
2006-Mar-14 15:17 UTC
[CentOS] PXE boot, Kickstart NFS install and %include...
I was just wondering how (or indeed if) people use the %include directive in Kickstart configuration files when building systems via NFS. I've been trying to modularise our Kickstart files a little to make things more readable, having generic defaults and role specific stuff split out into separate configs. I've tried this configuration... [root at archive kickstart]# cat centos4-install-ks.cfg # Kickstart to build default CentOS system # # $Id: centos4-install-ks.cfg,v 1.2 2006/03/13 14:21:32 root Exp root $ # # Setup kickstart defaults (keyboard, NFS server etc.) %include /opt/kickstart/include/kickstart.cfg # Setup partitions (mailstore specific) %include /opt/kickstart/include/disk.cfg # Package list to install %packages %include /opt/kickstart/include/packages.cfg %post # Setup /etc/hosts with required ip/name mappings (mailstore specific) %include /opt/kickstart/include/hosts.cfg # Setup CentOS Yum repository %include /opt/kickstart/include/centos4-yum.cfg # Add CentOS GPG key used to sign their RPM packages rpm --import /usr/share/doc/centos-release-4/RPM-GPG-KEY-centos4 # Setup Dag repository %include /opt/kickstart/include/dag4-yum.cfg # Setup users and their authorized_keys %include /opt/kickstart/include/users-and-keys.cfg # Setup secure SSHD configuration %include /opt/kickstart/include/secure-sshd.cfg # Setup Sudo %include /opt/kickstart/include/sudo.cfg # Setup Nagios Remote Plugin Execution %include /opt/kickstart/include/nagios-nrpe.cfg # Setup Bacula, /etc/bacula/bacula-fd.conf still needs to have the finalised # hostname entered manually :( (for now) %include /opt/kickstart/include/bacula.cfg # Install "standard" additional components yum -y install keychain bash-completion multitail webmin And a sample of one of the modular configs... [root at archive kickstart]# cat include/secure-sshd.cfg # Lock down sshd_config to only accept SSH2 keybased auth mkdir -p /etc/ssh/RCS ci -t-"Main SSHD configuration file." -u /etc/ssh/sshd_config co -l /etc/ssh/sshd_config cat <<EOF > /etc/ssh/sshd_config # # Main SSHD configuration file. # # \$Id\$ # # FILE UNDER RCS, DO NOT EDIT WITHOUT CHECKING OUT!!! Port 22 Protocol 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key SyslogFacility AUTHPRIV PermitRootLogin without-password StrictModes yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys IgnoreRhosts yes PasswordAuthentication no X11Forwarding yes EOF ci -m"Kickstart: Secured SSH configuration, locked down to keys-only config." -u /etc/ssh/sshd_config Which doesn't work, Anaconda runs and starting prompting for input as it would for a manual install. If I include everything pre-%post (IYSWIM) in the main Kickstart file then everything works as expected up till the %post %includes when Anaconda complains it can't find blah.cfg, presumably because it's not local. I could live with the body of Kickstart config in the main file and then manually NFS mount and reference the modular configs, if I have to, but I wondered is there a better method? I've Googled around a bit and found these threads from '02... https://www.redhat.com/archives/kickstart-list/2002-May/msg00184.html https://www.redhat.com/archives/anaconda-devel-list/2005-October/msg00080.html Which clarify what's going on but not really how people deal with %include and NFS. Will.
Rex Dieter
2006-Mar-14 15:27 UTC
[CentOS] Re: PXE boot, Kickstart NFS install and %include...
Will McDonald wrote:> I was just wondering how (or indeed if) people use the %include > directive in Kickstart configuration files when building systems via > NFS.Wow, way cool. Is this %include magic actually documented anywere? -- Rex
Aleksandar Milivojevic
2006-Mar-14 15:37 UTC
[CentOS] PXE boot, Kickstart NFS install and %include...
Quoting Will McDonald <wmcdonald at gmail.com>:> I was just wondering how (or indeed if) people use the %include > directive in Kickstart configuration files when building systems via > NFS. I've been trying to modularise our Kickstart files a little to > make things more readable, having generic defaults and role specific > stuff split out into separate configs.The %include directives are parsed two times by Anaconda. First time before %pre scripts are executed, and then after %pre scripts are executed. The missing files are ignored on the first parsing of kickstart file. However, Anaconda will complain if they are missing when it parses the file for the second time (just after %pre scripts are executed). This allows you to create those files dynamically from the %pre scripts (or make them accessible if already stored somewhere). You must ensure that all files referenced by %include directives exist and are accessible by the time %pre scripts finish (for example, by creating the file in %pre script or by NFS mounting the directories where they live from %pre script). If else fails, you can always copy the files locally using %pre script... -- See Ya' later, alligator! http://www.8-P.ca/
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. -- Ron Loftin reloftin at twcny.rr.com "God, root, what is difference ?" Piter from UserFriendly
saveline@alinto.net
2006-Mar-23 15:32 UTC
[CentOS] PXE boot, Kickstart NFS install and %include...
> 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 server. You can see my kickstart file : install 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 skipx network --device eth0 --bootproto static --ip 85.5.11.144 --netmask 255.255.255.0 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 reboot %include /mnt/ks/partition %include /mnt/ks/package %pre mkdir /mnt/ks mount my.machine.int:/var/kickstarttest /mnt/ks %post %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 DAEMON=no QUEUE=1h EOF2 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" EOF5 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 EOF10
Will McDonald
2006-Mar-23 16:01 UTC
[CentOS] PXE boot, Kickstart NFS install and %include...
On 23/03/06, saveline@alinto.net <saveline@alinto.net> wrote:> > 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 > server. > You can see my kickstart file : > > install > 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 > skipx > network --device eth0 --bootproto static --ip 85.5.11.144 --netmask > 255.255.255.0 > 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 > reboot > > %include /mnt/ks/partition > %include /mnt/ks/package > > %pre > mkdir /mnt/ks > mount my.machine.int:/var/kickstarttest /mnt/ksThat looks pretty much like what I have working. When you''re mounting my.machine.int, are you using an IP address or is that the hostname? I''d try using the IP in case you don''t have name services available. You can keep an eye on what KickStart is doing by by switching virtual consoles as usual: Alt-F1 - installation dialog Alt-F2 - shell prompt Alt-F3 - install log (messages from install program) Alt-F4 - system log (messages from kernel, etc.) Alt-F5 - other messages Alt-F3 is especially useful when dealing with errors in your Kickstart configuration files. Here''s the config I currently have.... # Kickstart to build default CentOS system # # $Id: centos4-install-ks.cfg,v 1.5 2006/03/21 14:57:18 root Exp $ # # Setup kickstart defaults (keyboard, NFS server etc.) # %include /mnt/ks/kickstart/include/kickstart.cfg # standard Kickstart defaults for keyboard, languange, NFS server etc. etc. nfs --server=192.168.24.218 --dir=/opt/centos/4/os/i386 lang en_US.UTF-8 langsupport --default=en_GB.UTF-8 en_GB.UTF-8 keyboard uk reboot text network --device eth0 --bootproto dhcp rootpw --iscrypted $1$wUjJ2O2O$xhfsduRpIbo2h7TVtT6Wo1 firewall --disabled selinux --disabled authconfig --enableshadow --enablemd5 timezone --utc Europe/London bootloader --location=mbr # Setup partitions %include /mnt/ks/kickstart/include/disk.cfg # Package list to install %include /mnt/ks/kickstart/include/packages.cfg %pre mkdir /mnt/ks mount 192.168.24.218:/opt/ /mnt/ks %post # Setup CentOS Yum repository %include /mnt/ks/kickstart/include/centos4-yum.cfg [lots of other stuff after here]
saveline@alinto.net
2006-Mar-23 16:42 UTC
[CentOS] PXE boot, Kickstart NFS install and %include...
Will McDonald a ?crit :> On 23/03/06, saveline@alinto.net <saveline@alinto.net> wrote: > >> 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 >> server. >> You can see my kickstart file : >> >> install >> 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 >> skipx >> network --device eth0 --bootproto static --ip 85.5.11.144 --netmask >> 255.255.255.0 >> 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 >> reboot >> >> %include /mnt/ks/partition >> %include /mnt/ks/package >> >> %pre >> mkdir /mnt/ks >> mount my.machine.int:/var/kickstarttest /mnt/ks >> > > That looks pretty much like what I have working. When you''re mounting > my.machine.int, are you using an IP address or is that the hostname? > I''d try using the IP in case you don''t have name services available. > > You can keep an eye on what KickStart is doing by by switching virtual > consoles as usual: > > Alt-F1 - installation dialog > Alt-F2 - shell prompt > Alt-F3 - install log (messages from install program) > Alt-F4 - system log (messages from kernel, etc.) > Alt-F5 - other messages > Alt-F3 is especially useful when dealing with errors in your Kickstart > configuration files. > > Here''s the config I currently have.... > > # Kickstart to build default CentOS system > # > # $Id: centos4-install-ks.cfg,v 1.5 2006/03/21 14:57:18 root Exp $ > # > > # Setup kickstart defaults (keyboard, NFS server etc.) > # %include /mnt/ks/kickstart/include/kickstart.cfg > # standard Kickstart defaults for keyboard, languange, NFS server etc. etc. > > nfs --server=192.168.24.218 --dir=/opt/centos/4/os/i386 > lang en_US.UTF-8 > langsupport --default=en_GB.UTF-8 en_GB.UTF-8 > keyboard uk > reboot > text > network --device eth0 --bootproto dhcp > rootpw --iscrypted $1$wUjJ2O2O$xhfsduRpIbo2h7TVtT6Wo1 > firewall --disabled > selinux --disabled > authconfig --enableshadow --enablemd5 > timezone --utc Europe/London > bootloader --location=mbr > > # Setup partitions > %include /mnt/ks/kickstart/include/disk.cfg > > # Package list to install > %include /mnt/ks/kickstart/include/packages.cfg > > %pre > mkdir /mnt/ks > mount 192.168.24.218:/opt/ /mnt/ks > > %post > # Setup CentOS Yum repository > %include /mnt/ks/kickstart/include/centos4-yum.cfg > [lots of other stuff after here] > _______________________________________________ > CentOS mailing list > CentOS@centos.org > http://lists.centos.org/mailman/listinfo/centos >OK thanx I will try to debug my config, I didn''t think about switching virtual console. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.centos.org/pipermail/centos/attachments/20060323/5c6247c8/attachment.htm
saveline@alinto.net
2006-Mar-24 13:25 UTC
[CentOS] PXE boot, Kickstart NFS install and %include...
saveline@alinto.net a ?crit :> >> 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 server. > You can see my kickstart file : > > install > 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 > skipx > network --device eth0 --bootproto static --ip 85.5.11.144 --netmask > 255.255.255.0 > 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 > reboot > > %include /mnt/ks/partition > %include /mnt/ks/package > > %pre > mkdir /mnt/ks > mount my.machine.int:/var/kickstarttest /mnt/ks > > %post > %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 > DAEMON=no > QUEUE=1h > EOF2 > > 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" > EOF5 > 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 > EOF10 > > > > _______________________________________________ > CentOS mailing list > CentOS@centos.org > http://lists.centos.org/mailman/listinfo/centosI''ve tried by changing my.machine.int into an ip address and the debug console tells me there is a command that anaconda doesn''t understand (but it didn''t tell me which). I''m wondering if it there would be another method to include script without using nfs mounts ? PS : here is my /etc/exports (I use the second export) : /var/kickstart/ 192.168.0.0/255.255.255.0(rw,no_root_squash,sync) /var/kickstarttest/ 192.168.0.0/255.255.255.0(rw)
Sébastien AVELINE
2006-Mar-29 09:12 UTC
[CentOS] PXE boot, Kickstart NFS install and %include...
saveline@alinto.net a ?crit :> >> 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 server. > You can see my kickstart file : > > install > 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 > skipx > network --device eth0 --bootproto static --ip 85.5.11.144 --netmask > 255.255.255.0 > 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 > reboot > > %include /mnt/ks/partition > %include /mnt/ks/package > > %pre > mkdir /mnt/ks > mount my.machine.int:/var/kickstarttest /mnt/ks > > %post > %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 > DAEMON=no > QUEUE=1h > EOF2 > > 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" > EOF5 > 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 > EOF10 > > > > _______________________________________________ > CentOS mailing list > CentOS@centos.org > http://lists.centos.org/mailman/listinfo/centosI found my problem, you can consider it as close. I''ve written my file in dos mode and it couldn''t be parsed by anaconda. I am sorry to have disturbed you with my problem.