Rolling Out Unattended Debian Installations (Part 1)
Requirements and Overview
The next time you have a hankerin' to install a new batch of Debian machines, make it easy on yourself and use FAI (Fully Automatic Installation). FAI is a versatile, intelligent installer for performing mass unattended Debian installations. Use it to install clusters, server farms, classroom computer labs, or new LANs. An automatic installer has all kinds of possible uses:
You will build a central installation server containing a Debian mirror. This can be any old PC with a large hard drive; you'll need around 10 gigabytes of storage space just for the Debian package files. (Don't even try this without a high-speed Internet connection.) A laptop makes a great portable FAI server. The installation clients will get their files from this server. The clients need only to be connected to the network, and booted either from floppy disk or network card. Files are transferred to the clients via your choice of HTTP, FTP, or NFS.
Installing and configuring FAI has two parts: the installation server configuration, and customizing the client installation scripts. Once this is done FAI does all the work, and all you need to do is not make it look too easy. Part 1 covers building the server; Part 2 will show how to set up the client configurations and run a client installation.
Setting Up A Local Debian Mirror
As always, run apt-get update first to update your package lists. Then install all the necessary packages for FAI:
# apt-get install fai fai-kernels debmirror mknbi dhcp3-server bootp tftpd-hpa rsh-server rsync
You'll find out what all of these do as we go along. Next, create a directory to house your mirror. Remember, you'll need a lot of disk space. In this example it is /debmirror, isolated on its own partition, and there are 15 nice plump gigabytes allocated for it.
Now you can download the files. Check the mirror list to find a close download site. Use the mkdebmirror script, located in /usr/share/doc/fai/examples/utils/ to download and build the mirror. mkdebmirror uses debmirror and rsync, and creates the mirror directories. First edit the script to suit your preferences. This example creates a Sid mirror. Note that the original script included with FAI mirrors the security archive. This is not a good idea. For one thing, there is no security archive for Sid. For another, security updates should be downloaded directly from debian.org, so get rid of the debian-security section. It also helpful to add the -v flag to the debmirror commands, so you that can monitor progress. This is a complete example:
# - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Save your changes and run your mkdebmirror script:
rsync can be a bit funky; if it fails with an error message, try re-running the script a couple of times before looking for script errors.
Configuring The FAI Server
While the mirror files are downloading is a good time to configure the server. Open /etc/fai/sources.list and configure one section to point to your local FAI server; this is what the client machines will use. See /usr/share/doc/examples/etc/sources.list for help with this.
Next, edit /etc/fai/fai.conf. In this example, the mirror server is Windbag, configured to use FTP. You may choose FTP, HTTP, or NFS:
# if your server has multiple network cards, specify
# the fai-setup script will create the "fai" user
# the configuration space on the install server
# the type of operating system (linux, sunos)
Finally, edit /etc/fai/make-fai-nfsroot.conf. NFS is the fastest method for the client installations, the FAI server installation requires it, and you'll still have the option to use FTP or HTTP for the client installation.
Now run the fai-setup script:
This will take awhile, as it needs to build a nice chrooted NFS filesystem, generate SSH keys, and copy lots of files. When it is all finished, your FAI server is ready to go. Come back next week to learn how to configure and perform the client installation.
FAI comes with an excellent manual, which is also installed to /usr/share/doc/fai/fai-guide.html. The /usr/share/doc/fai/ directory is full of scripts and configuration examples.