Changes between Initial Version and Version 1 of sol4/IDMS/CreateImages


Ignore:
Timestamp:
01/15/14 16:29:43 (10 years ago)
Author:
nriga@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • sol4/IDMS/CreateImages

    v1 v1  
     1== Overview ==
     2
     3These instructions outline the steps for creating Debian-based (e.g. Ubuntu) images on ExoGENI and then converting them for use on ProtoGENI.
     4
     5== Create a file to store the new OS filesystem ==
     6
     7
     8 * Here we create a 1GB file
     9
     10{{{
     11dd if=/dev/zero of=ubuntu_12.04_fs bs=4096 count=262144
     12262144+0 records in
     13262144+0 records out
     141073741824 bytes (1.1 GB) copied, 1.62763 s, 660 MB/s
     15}}}
     16
     17 * Create a loopback device and filesystem, then mount on /mnt/loop.
     18
     19{{{
     20sudo losetup -f --show ubuntu_12.04_fs
     21/dev/loop0
     22sudo mkfs.ext4 /dev/loop0
     23sudo mount /dev/loop0 /mnt/loop
     24}}}
     25
     26 * We can now bootstrap our OS onto this loopback filesystem.
     27
     28== Ubuntu Image Creation using debootstrap ==
     29
     30 * Get debootstrap for Ubuntu 12.04 "precise"
     31
     32{{{
     33mkdir ubuntu_bootstrap
     34cd ubuntu_bootstrap/
     35wget http://archive.ubuntu.com/ubuntu/pool/main/d/debootstrap/debootstrap_1.0.56_all.deb
     36ar -xf debootstrap_1.0.56_all.deb
     37tar -xf data.tar.xz
     38tar -xf control.tar.gz
     39}}}
     40
     41 * Get the Ubuntu keyring to we can verify packages that get installed by deboostrap.
     42
     43{{{
     44wget http://archive.ubuntu.com/ubuntu/pool/main/u/ubuntu-keyring/ubuntu-keyring_2012.05.19.tar.gz
     45tar -xf ubuntu-keyring_2012.05.19.tar.gz
     46}}}
     47
     48 * Now we can run the deboostrap just downloaded and install a new OS onto the loopback fs we created earlier.
     49
     50{{{
     51sudo DEBOOTSTRAP_DIR=/vm/ubuntu_bootstrap/usr/share/debootstrap usr/sbin/debootstrap --arch amd64 --keyring=ubuntu-keyring-2012.05.19/keyrings/ubuntu-archive-keyring.gpg precise /mnt/loop http://us.archive.ubuntu.com/ubuntu/
     52}}}
     53
     54 * Once the boostrap completes, we have a base OS install in the ubuntu_12.04 directory.  We can now chroot and install additional packages.
     55
     56{{{
     57sudo chroot /mnt/loop
     58apt-get update
     59apt-get install linux-image sudo python ...
     60}}}
     61
     62 * To allow the ProtoGENI EC2 conversion tool to work, we need the following packages at a minimum.
     63
     64{{{
     65apt-get install sudo ruby unzip rsync ssh
     66}}}
     67
     68 * We can also set a root password using 'passwd' within the chroot.
     69 * To ensure that the file compresses well, we want to write zeros into all the free space on the filesystem.  While chrooted, run:
     70
     71{{{
     72dd if=/dev/zero of=./zeros && rm -f ./zeros
     73}}}
     74
     75 * To finish up, unmount and remove the loopback device.
     76
     77{{{
     78umount /mnt/loop
     79losetup -d /dev/loop0
     80}}}
     81 
     82== Prepare the image for ExoGENI ==
     83
     84 * By installing the linux-image (or linux-image-virtual) package, we have a kernel with which we can boot the OS as a VM.  The kernel can be found in /boot
     85 * Copy the kernel as well the the initrd image to a temporary directory.
     86 * We can test booting the new OS with qemu.
     87
     88{{{
     89mkdir kernel
     90sudo cp /mnt/loop/boot/vmlinuz-3.2.0-23-generic kernel/
     91sudo cp /mnt/loop/boot/initrd.img-3.2.0-23-generic kernel/
     92sudo umount /mnt/loop
     93
     94sudo qemu-system-x86_64 -kernel kernel/vmlinuz-3.2.0-23-generic -initrd kernel/initrd.img-3.2.0-23-generic -append "root=/dev/sda ro" ubuntu_12.04_fs
     95}}}
     96
     97
     98 * If the image boots, then we have a working OS!
     99 * Now we need to install the NEUCA tools that will allow the image to work on ExoGENI racks.
     100 * Follow the instructions found here: [https://geni-orca.renci.org/trac/wiki/NEuca-guest-configuration NEUCA Guest Configuration]
     101 * Get the latest NEUCA tools from SVN to be safe.
     102
     103 * Create the image metadata file and place in a web directory as per these intructions: [https://geni-orca.renci.org/trac/wiki/virtual-machines ExoGENI/ORCA Virtual Machine Images]
     104
     105== Converting a running ExoGENI image for use on ProtoGENI ==
     106
     107TODO