Thursday, March 17, 2011

creating a ubuntu 10.04 server image for KVM

KVM a hypervisor.

on ubuntu machine, follow these steps

0-download ubuntu 10.04 or other releases
lets call this file ubuntu-10.04-server-i386.iso

1- install kvm using
aptitude install kvm

2- create a disk image using dd. let say 5GB disk image
dd if=/dev/zero of=ubuntu-server.img bs=1G count=5

3-assuming that iso and ubuntu-server.img files are in the same directory.
create kvm vm using the following command. This vm will have 512 MB memory.

kvm -m 512 -cdrom ubuntu-10.04.iso -boot d ubuntu-server.img

to test it, run the vm using

kvm -m 512 -cdrom ./ubuntu-10.04-server-i386.iso ubuntu_server.img

done