It has been a long time I want to prepare a pure Debian virtual image for the Amazon elastic computer cloud, that would contain the bioinformatics tools that we package in Debian Med. Most methods discussed in the ec2debian group use debootstrap, and finish the preparation with external scripts. Now that Amazon Machine Images can boot on their original kernel, I am exploring the use of the debian installer to setup a pristine system on a elastic block storage volume.
The Debian installer can be booted with GRUB and preseeded through a file downloaded early after starting. In the Amazon cloud, this file can be put at http://169.254.169.254/latest/user-data
with the other instance metadata. Since I am not much experienced in this field, I progress slowly on automating the procedure. For the moment, preseeding is not comprehensive, but at least the installer's SSH console is started. Ideally, one should connect using a key, but for the moment I go with a password. Currently, I am stuck with the partitioning of the hard drive:
‘No root file system is defined
’.
http://d-i.alioth.debian.org/manual/en.amd64/ch05s01.html#boot-initrd
http://docs.amazonwebservices.com/AmazonEC2/dg/2007-01-03/AESDG-chapter-instancedata.html
Here are a couple of technical details. I use the cheapest instances, t1.micro (32 bits) for the tests. I downloaded debian-installer
on an elastic volume of 1 Gb, that I formatted in ext2
. Not knowing if the device name will stay stable (/dev/sda1
or /dev/xvda1
), I flagged the partition, as I have seen in Ubuntu virtual machines.
ARCH=i386 DIST=squeeze DI_VERSION=20110106+squeeze3 MIRROR=jp BASEURL=http://ftp.$MIRROR.debian.org/debian/dists/$DIST/main/installer-$ARCH/$DI_VERSION/images/netboot/xen mke2fs -L debian-installer /dev/sdb -F mount LABEL=debian-installer /mnt/ && cd /mnt/ wget $BASEURL/initrd.gz $BASEURL/vmlinuz mkdir -p boot/grub cat > boot/grub/menu.lst <<__END__ default 0 timeout 3 title Debian Installer ($DI_VERSION $ARCH) root (hd0) kernel /vmlinuz root=LABEL=debian-installer ro console=hvc0 auto=true priority=critical url=http://169.254.169.254/latest/user-data initrd /initrd.gz __END__
A snapshot of this volume can then be registered as an image machine. The kernel to use will depend on whether the system has been installed in the whole volume or a partition. Debian distributes tools for all these operations, such as euca2ools.
http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?UserProvidedkernels.html