CreatingRHELImages

To create custom RHEL/Centos images you will need to do following things

1. Install Centos/RHEL and install any type of packages you need on it

2. You will need to change the root device in /etc/fstab to /dev/vda ie.

/dev/vda                /                       ext3    defaults        1 1

2. Next you will need to install at minimum. Please check NovaInstall/CentOSNotes for hints how to do it

python26, python26-distribute and euca2tools and MCrypto

easy_install-2.6 boto==1.9b

3. Get your credentials and source the novarc file

source novarc

4. Generate the ramdisk that includes the virtio drivers which Nova needs

mkinitrd --with virtio_pci --with virtio_ring --with virtio_blk --with virtio_net --with virtio_balloon --with virtio -f /boot/initrd-$(uname -r).img $(uname -r)

5. Bundle and upload the ramdisk and kernel

BUCKETNAME="mybucket" euca-bundle-image -i /boot/initrd-$(uname -r) --ramdisk true euca-upload-bundle -b $BUCKETNAME -m /tmp/initrd-$(uname -r).manifest.xml euca-register $BUCKETNAME/initrd-$(uname -r).manifest.xml

This will give you an AMI id for RAMdisk. Write it down.

euca-bundle-image -i /boot/vmlinuz-$(uname -r) --kernel true euca-upload-bundle -b $BUCKETNAME -m /tmp/vmlinuz-$(uname -r).manifest.xml euca-register $BUCKETNAME/vmlinuz-$(uname -r).manifest.xml

This will give you an AMI id for the kernel. Write it down.

6. Bundle and upload the volume

Run bundle volume. Replace ami-KERNEL and ami-RAMDISK with the IDs you got in previous step

euca-bundle-vol --kernel ami-KERNEL --ramdisk ami-RAMDISK -d /mnt -p rhel5 -s 10000 -e /mnt,/root/.ssh  --no-inherit euca-upload-bundle -b $BUCKETNAME -m /mnt/rhel5.manifest.xml euca-register $BUCKETNAME/rhel5.manifest.xml

This will give you the machine AMI ID. You can now use it to startup the machine e.g.

euca-run-instances ami-MACHINE -k mykeyname -t m1.tiny