Yesterday I wrote about solutions for deploying and installing machines with installimage. As mentioned, these scripts need to be executed via a live linux system. Today I’m presenting you LARS, a Live Linux perfectly suited for this purpose. LARS is maintained by the VirtAPI Team and is based of a modified Archlinux (alos called arch) environment. How does this magic work?
The main script is build.sh, this will fetch a minimal list of needed packages and installs them in a subdir, than adds packages from packages.both to it. Now you already have a small arch installation in a subdirectory where you could chroot into. The build.sh script also adds syslinux and EFI support into it, this allows us to boot the ISO via BIOS and (U)EFI mode from USB/CD drives but also from a PXE server.
Before the ISO file will be created the customize_airootfs.sh script will be executed in a sort of chroot. This allows us to place hardcoded ssh key in the authorized_keys file, usage of internal mirrors or also modifying the fstab to automount our NFS server on startup that serves the installimages itself and the images.
Every configuration option should be available in config.sh, this file is used for configuring the deployment of the image but also for settings inside of the ISO itsef.
The ISO has a cool default behaviour: you can add a “script=http://…bla.sh” like param to the kernel cmdline, the ISO will detect this after the startup, do a autologin in TTY1, download the script an than executes it. This magic is done be the automated_script.sh which is simply triggered by the .bash_profile.
We created the rebuild_and_copy.sh script to easily rebuild the ISO and copy it to the DHCP server. It takes care about cleaning up your build environment before building the ISO via build.sh and also copies it to the DHCP server where it gets extracted.
How to boot it?
We wrote an example pxelinux config that you can use. We will add this later to our github repo. In the next weeks we will also create a Puppet module which will configure a server with NFS, TFTPD + pxelinux, nginx and isc-dhcpd to serve LARS and installimage to all nodes on your network. Let me know if you have got any suggestions or questions!