Red Hat and its many clones and offspring, like Fedora, CentOS, White Box Linux, have long had a simple built-in mechanism for cloning installations on diverse hardware: Kickstart. With Kickstart you can easily create a customized configuration, set up an installation server, plug a new PC into the network, and perform an unattended network installation. SUSE has AutoYaST.
Whether you’re rolling out a collection of servers or looking for a way to get new ones in service quickly, Debian pre-seeding makes it easy.
Debian users have not been so fortunate. FAI, the Fully-Automated Installer, works beautifully when it’s set up correctly. But learning to use FAI is not so easy.
Of course, the Linux world does not stand still. The shiny new Debian Sarge installer introduced a new feature called pre-seeding. Pre-seeding means creating an answer file that answers all questions asked by the installer. Pre-seeding supports both local installations from bootable media and network installations. There are a number of ways to do this:
- Local installation with the standard installation CD/DVDs, plus the preseed file on removable media
- Local installation with the standard installation CD/DVDs, plus the preseed file fetched from a network drive
- Network installation from a Debian mirror or a local mirror
- Using a remastered CD or DVD containing the preseed file
This two-part series covers network installation of Etch, the Testing release of Debian. (There are a lot of changes from Sarge, the Stable Debian release. Each one has its own excellent official Debian installation manual, so make sure you have the right one.) Part 1 will illustrate a couple of simple ways to generate and use a preseed configuration file. Part 2 will detail how to configure the preseed configuration file and set up a local mirror for fast automatic installations.
| Automate Linux Installs With Debian Pre-Seeds, Part 2 |
|---|
Quick Start For the Madly Impatient
You can easily test this with your existing Debian installation. It should also work with Ubuntu/Kubuntu/Edubuntu/Xubuntu/Metoobuntu/etc. Two important limitations you should know about are: There is no way to use an existing partitioning scheme, so you must use either free space or the entire hard disk, and you cannot set up RAID yet with pre-seeding.
First install debconf-utils, then extract the contents of /var/log/installer/cdebconf, which is a database of everything installed on the system, into a preseed.cfg file:
|
|---|
preseed.cfg is a plain-text file, as this snippet from a Kubuntu system shows:
|
|---|
You can copy this file to removable media and use it with your Debian (or *buntu) installation CD to create a duplicate installation on a second PC. To do this, boot up the installation disk with a parameter telling the installer where to find the preseed file, and to not pester you with any but the most important questions:
|
|---|
This is a easy method for replicating installations on a small network. A useful hack is to store several different preseed files on a USB stick for different types of installations (e.g., workstations, firewalls, and file servers). You might still have to answer a configuration question or two, but you can tweak also the preseed configuration files to make it completely automatic, which we’ll discuss in Part 2.
USB Stick Network Installation
If you have a USB stick with 128 MB or greater capacity, you can use it to boot the Etch installer, and then start the installation with a small .iso image. The installer will give you a list of Debian mirrors to choose from to complete the installation. First, download hd-media/boot.img.gz to your PC’s hard drive. You’ll find it on any Debian mirror, like mirrors.kernel.org. Then, download the business-card CD image.
Now prepare your USB stick. Delete all existing partitions, then create at least one new partition, and format it with the FAT filesystem. If your USB stick is larger than 128 MB you may create more than one partition; just be sure to reserve the first partition for the Etch installer.
Find the drive’s block device name:
|
|---|
Make sure it is not mounted. If it is, unmount it. This example shows that it is not:
|
|---|
Now display the existing partitions:
|
|---|
Go ahead and delete the partition(s):
|
|---|
Fire up fdisk again, this time to create and label a new partition:
|
|---|
Now give it a filesystem:
|
|---|
If you’re wondering why you need to do this when you know you have a perfectly reliable USB stick, feel free to omit all the partitioning and creating-filesystem steps. In my estimable opinion it prevents strange and vexing errors.
Copying the Boot Files
Now extract the boot files to the USB stick:
|
|---|
This will take a few minutes. When it’s finished, mount the USB stick and copy the CD image to it. You’ll have plenty of room left over for your preseed configuration file, or even several of them. To use preseed files on the USB stick, make sure they are in the top-level directory. Boot up with the USB stick, then boot with these parameters:
|
|---|
With a small modification you may use this same technique for local network installations. Come back next week to learn how to do this, plus how to fine-tune the preseed configuration file.
Resources
- Debian GNU/Linux Installation Guide for Etch
- Debian GNU/Linux Installation Guide for Sarge
- Apt-proxy
- Apt-mirror
This article originally appeared on EnterpriseNetworkingPlanet.com.