Configuring a FreeBSD "Kickstart" server
                        by Steven St.Laurent  - steven@403forbidden.net


Intro

Ducks
Ingredients
Security
Contributing

Files
Distro
Files
Files
Mfsroot
Patch
PXEBoot
Boot
Kernel

Services
INETD
DHCP
TFTP
NFS
FTP

Details
How it works
Loader.rc

Installing

Finishing


	MFSROOT

	This is where the rubber meets the road. The mfsroot is where the installer is
	automated and everything we need is configured.

	The mfsroot can be highly customized to suit your needs. The typical mfsroot 
	needs to fit on a floppy disk so it is a bit limited. I've not found a reason 
	to create a mfsroot much bigger yet. Since this image will be on a filesystem 
	instead of a floppy we can make it as large as me might need. Add anything 
	you might need.


	Locate the mfsroot.flp from your desired distribution. The following should work fine.

	$ fetch http://ftp2.freebsd.org/pub/FreeBSD/releases/i386/4.8-RELEASE/floppies/mfsroot.flp \
	  mfsroot.flp
	$ vnconfig vn0 mfsroot.flp
	$ mount /dev/vn0 /mnt
	$ cp /mnt/mfsroot.gz /tmp
	$ umount /mnt
	$ vnconfig -u vn0
	$ gunzip mfsroot.gz
	$ vnconfig vn0 mfsroot
	$ mount /dev/vn0 /mnt
	$ cd /mnt

        You will notice the mounted mfsroot image has the following directory structure

                bin -> stand/
                boot/
                dev/
                etc/
                mnt/
                sbin -> stand/
                stand/

        What we need is a install.cfg here to automate the installation process. We do not want to
        be bothered with having to type anything. Here is my installation file.
        The nfs path below should be exported. Copy the FreeBSD iso (disk 1) to this path. I
        created a directory called 4.8 under /opt/export for it.

	Here is a copy of my install.cfg:

        ################################
        # No Interaction
 
                nonInteractive=YES
                noWarn=YES
                tryDHCP=YES

        ################################
        # My host specific data

                hostname=CHANGEME
                domainname=403forbidden.net

        ################################
        # Which installation device to use

                nfs=192.168.1.2:/opt/export/4.8
                netDev=em0
                tryDHCP=YES
                mediaSetNFS

        ################################
        # Select which distributions we want.

                dists= bin doc manpages catpages proflibs dict info des compat22 compat3x crypto ports
                distSetCustom

        ################################
        # Now set the parameters for the partition editor.

                disk=ad0
                partition=all
                bootManager=standard
                diskPartitionEditor

        ################################
        # All sizes are expressed in 512 byte blocks!

                ad0s1-1=ufs 256000 /
                ad0s1-2=swap 256000 none
                ad0s1-3=ufs 256000 /var
                ad0s1-3=ufs 0 /usr
                diskLabelEditor

        installCommit

        ################################
        # Install any packages

        package=sudo-1.6.6.1
        packageAdd
       package=gmake-3.80
        packageAdd
        package=libtool-1.3.4_4
        packageAdd
        package=gdbm-1.8.0
        packageAdd
        package=cvsup-without-gui
        packageAdd
        package=postinstaller-1.0
        packageAdd

        shutdown


	Here we can add any number of specific packages OR we can run custom
        scripts to preconfigure the system. I prefer the package route. While
        it is more complicated it gives an auditable trail to determine every
        system change providing you are dilligent. I can easily check that
        my postinstall was performed and later on if I distribute a 2nd script
        I know it will work with my previous package. If not I can easily see
        what has been applied. Sloppy SA's make undocumented changes. Smart
        SA's use package managers for all their documented changes.

        Next we need to modify sysinstall. Apparently sysinstall has a klunky piece
        of code which when run as init, which we do when we are doing a cdrom, ftp
        or net install. This piece of code prompts you for what terminal emulation
        you wish to run. The problem here is even IF you set nonInteractive=YES
        you still have to run this interactively. Pain in the ascii! So just
        modify the file /usr/src/release/sysinstall/termcap.c to not check.


        There is a better way of doing this by adding a variable to the install.cfg
	but I was not able to get it to work properly. I was lazy and this is a 
        sysinstall just for remote installations, so I hard coded my TERM and moved on. 
	The next section contains a diff of what I changed.

        do a make clean && make depend && make

        copy this new sysinstall to the mfsroot image.


        Now unmount the image
                
        $ cd /
        $ umount /mnt
        $ vnconfig -u vn0

        we now have a mfsroot with a custom installer.




Copyright © 2003 - Steven St.Laurent - steven@403forbidden.net