Linux quick unattended distribution install

What is this “Linux Quick Distribution Install” about?

Bad Penguin’s Linux Quick Distribution Installer allow you to create a customized installation procedure to replicate your favourite Linux setup.

The tool allow to create a bootable CDROM, USB memory stick, TFTP network boot that allow you to install in 10 minutes your customized Linux distribution.

The tool works by allowing you to automatically create your disk partition layout, format them, and unpack your software onto it, install MBR and boot manager, reboot into your replicated system.

What you need to do is to prepare a configuration file and a tarball to put inside our bootable image.

Why to use this instead of other tools?

First of all we don’t clone partition or stuffs. We make a tarball of your working installation then you can replicate this tarball in many different partition scheme: you can put it inside a 1GB compact flash or install it into a complicated five disks array without changing anything except the plain text config file.

Unpacking the tarball is faster then going thru Debian preseed system… i’m bored of waiting apt-get and dpkg doing the same job over and over… i install my Debian server in 5 minutes!

Success stories

  1. MercuriusPBX has Debian, a custom kernel, custom kernel modules, asterisk self compiled, dnsmasq patched and self compiled, lspci patched and self compiled and other stuffs not in official debian repository; we also install everything inside 1GB compact card flash; the tool allow to have us a 300MB tarball that is installed in 10 minutes (since CF is slow in writing);
  1. Debian, Apache, PHP, MySQL and vTiger pre-installed and pre-configured; its a 350MB tarball and i can install it in 5 minutes and at reboot i’ve already it working with default users and profiles i choose;

Status of the project

It works for me and my usual setups. The initial release 1.0.0 has been uploaded to SourceForge now.

Things that will added soon:

  • partition layout:
    • MD support
    • LVM support
  • boot:
    • extlinux support
  • source media:
    • create usb stick
    • create net boot

Download from http://sourceforge.net/projects/linux-quickinst/files/badpenguin_unattended_installer-1.0.0.tar.bz2/download

The bootable media

The bootable media will be based on Peter Avin’s syslinux project that provide: syslinux (USB boot), isolinux (CDROM boot) and pxelinux (TFTP boot).

We placed those files under bootimage-static.

The binary files needed are: isolinux.bin, ldlinux.sys, pxelinux.0, syslinux.exe and vesamenu.c32

The config files have different names but share the same syntax, they are: syslinux.cfg, isolinux.cfg and pxelinux.cfg/default.

The config file contains just:

include menu.cfg
default vesamenu.c32
prompt 0
timeout 0

this will allow use to have a nice graphic bootscreen at startup.

Customizing the bootable media

The files you want to change are instead stored under bootimage-config

The first one, menu.cfg, is the syslinux main config file; sure you need to change menu title and menu label to match your product name. If you need more customization you can read at http://syslinux.zytor.com/wiki/inde…

Then you have menu.png a 640×480 background screen, palette must be 256 colours.

Bad Penguin's syslinux custom logo

For the experts linux.k is your bzImage kernel and linux.i is just the initrd ROMFS from this project.

The main config file is badpenguin.cfg, its a “shell” thing so feel free to add also your custom functions to it.

The config file name can be overrided declaring the PRESEED variable as a kernel parameter in menu.cfg; this allow you to have multiple config file and products inside the same installation media;

Setup program

After you boot with syslinux the kernel and the initrd are loaded in memory then the Linux kernel start and /linuxrc is executed; this script does minimal initialization , using /etc/init.d/sysinit then start searching where is your bootable media, using /etc/init.d/sourcemedia and configure the network using /etc/init.d/netstart.

When this initialization is done it start the setup program: /root/mainmenu. Additional console are availables on tty2 and tty3 while dmesg output is on tty12 and debug output on tty4.

All those files are stored under initrd-filesystem if you want to contribute to development of this project.

/etc/init.d/sysinit

This script does minimal initialization, basically:

  • loading CMOS time into kernel clock
  • loading italian keymap (so please contribute to make this a configurable option)
  • mount filesystems: /proc, proc/bus/usb, /sys, /dev/pts, /dev/shm
  • mount ram disks: /tmp, /mnt, /var, /etc, /root
  • load some common drivers: eide/scsi/sata, network cards, usb
  • configure loopback interface

/etc/init.d/netstart

Before starting the network you need some network card modules driver loaded, to do this:

  • MODULES, contains a space separated list of kernel modules to load

This script configure eth0 via DHCP or static IP using configuration options, if both are present the static IP is assigned to eth0:1. The configuration options are:

  • NETWORK_DHCP, 0=off 1=on
  • NETWORK_ADDR, IP address
  • NETWORK_MASK, optional network mask
  • NETWORK_GW, optional default GW
  • NETWORK_DNS, optional one or more DNS server space separated list

Once the network is configured we can fix time using a timeserver. This will happen using rdate if you configured

  • NETWORK_RDATE, space separated list of IP/Host of valid time servers

Bad Penguin Unattended Installer sysinit screen

/root/mainmenu

As we said this will display the installation/setup menù with the following windows/options availables.

  • BACKTITLE is the variable that control the “dialog” like title appearing onto the 1st row of the screen

Disclaimer

First things the setup program is to ask the user confirmation about installing this software that can wipe auto your disk. Yes, i strongly advise to do all the development and the testing using virtual machines; QEMU works fine.

  • DISCLAIMER is the variable that control the text to display inside the confirmation box. If the variable is empty the disclaimer is not displayed.

Unattended Installer disclaimer screen

Target disk

  • TARGET_DISK is the device name to be prepared using fdisk, if the device is not present or the variable has some other value a dialog window is displayed showing the list of available disks; if the source media is a disk then its not displayed

Partitioning

  • TARGET_LAYOUT is list of GNU parted commands separated by a semicolon; each command is execute onto the selected TARGET_DISK;

The parted manual is available at http://www.gnu.org/software/parted/

Formatting

  • TARGET_FORMAT is list of formatting commands separated by a semicolon; each command is the partition number and the filesystem type separated by a space, for instance: TARGET_FORMAT="1 ext3;2 vfat;3 swap"

partition and formatting screen

Mount Points

  • TARGET_MOUNT is list of mount commands separated by a semicolon; each command is the partition number and the target root directory separated by a space, for instance: TARGET_MOUNT="2 /;1 /boot;3 /var;4 /home"

Make sure to put the “root” / partition as first element of the list or the setup will fail.

Install the product

  • TARGET_UNPACK will contain the name of the big tarball to unpack into the mounted filesystem struture, wew use bar to show you a nice progress bar of the estimated time;

image extraction using tar and progress bar

Post installation

Into the final step the /etc/fstab is automatically generated using your swap partition and mount points.

Then grub is installed into the TARGET_DISK.

Creating the media

After you’ve completed the configuration step just run make. The Makefile will create for you the initrd and then your bootable medias (cdrom, usb, pxe tftp).

The cdrom is bootimage.iso

Download

Check out the sourceforge page, files contain binary download while mercurial contains the most update source code.

 

Linux quick unattended distribution install, 5.0 out of 5 based on 1 rating
GD Star Rating
loading...