Cloud Infrastructure


Create a VM instructions

  • View the available images and make sure it does not already exist
  • user@client1:~$ euca-describe-images
  • Choose which OS you will install and download the iso file. During the following example we will create a centos image from the CentOS-6.0-i386-minimal.iso.

  • Fisrt we create an image file with the command:
    user@client1:~$ dd if=/dev/zero of=CentOS-6-i386.img bs=1M count=1024
    or you can use
    user@client1:~$ kvm-img create -f raw CentOS-6-i386.img 1G
    Formatting 'CentOS-6-i386.img', fmt=raw size=1073741824  
    Note: package 'qemu-kvm' must be installed. 'kvm-pxe' package may be needed too. Also VMX must be enabled from your computer bios.
    If your computer does not support virtualization you may use VirtualBox or VMware.
  • Start installation with the command:
    user@client1:~$ sudo kvm -m 512 -cdrom CentOS-6.0-i386-minimal.iso -drive file=CentOS-6-i386.img,if=scsi,index=0 -boot d -net nic -net user -nographic -vnc :0
  • Connect with vncviewer and complete instalation.
    vncviewer client1:0
  • Boot your image with the command:
    sudo kvm -m 512 --drive file=CentOS-6-i386.img,if=scsi,index=0,boot=on -boot c -net nic -net user -nographic -vnc :0
  • After booting and connecting with vnc the new vm may not have eth0 configured. Use dhclient eth0 to bring it up.
    Now install the software you would like to have on your vm.

  • Copy kernel and ramdisk to the host accessible via with the commands:
    scp /boot/initramfs-2.6.32-71.el6.i686.img user@
    scp /boot/vmlinuz-2.6.32-71.el6.i686 user@
  • Now that we have kernel and ramdisk we must extract main filesystem before uploading to eucalyptus.
    Find out the starting block and the block size of the root file systems. To do so you can use parted:
    user@client1:~$ sudo parted CentOS-6-i386.img
  • Get parted to use blocks as unit: type 'U' then 'b' (this will change the units to blocks)

    (parted) u
    Unit? [compact]? b
    then print the current partition table using 'p':
    note the start for the partition you are interested in and the size (for this example let's say start is 32256 and the size is 1024000);

  • Extract the file system:
    user@client1:~$ dd if=CentOS-6-i386.img of=CentOS-6-i386_rootfs.img bs=1 skip=32256 count=1024000
    NOTE: to speed up the process you can increase the block size, for exampe to 512: divide the size and the skip count by the new block size (512 in this case) and you get dd if=new.img of=rootfs.img bs=512 skip=63 count=2000

  • Now you have the file 'CentOS-6-i386_rootfs.img' which contains the root file system, the kernel and the ramdisk.

  • Upload it to eucalyptus. Only administrators can do this so prepare you usb stick.

  • Sources

University of Cyprus Nephelae cloud infrastructure is funded by the
University of Cyprus