Download the iso file of the Linux distribution you want to install in the image. For Ubuntu, you can download the iso from http://releases.ubuntu.com using 'wget' or with the help of a browser
Boot a KVM instance with the OS installer ISO in the virtual CD-ROM. This will start the installation process. The command below also sets up a VNC display at port 0
sudo kvm -m 256 -cdrom ubuntu-12.04-server-amd64.iso -drive file=server.img,if=virtio,index=0 -boot d -net nic -net user -nographic -vnc :0
Connect to the VM through VNC (use display number :0) and finish the installation.
For Example, where 10.10.10.4 is the IP address of client1:
vncviewer 10.10.10.4 :0
During creation of Linux images , create a single ext4 partition mounted on a swap partition.
After finishing the installation, relaunch the VM by executing the following command.
sudo kvm -m 256 -drive file=server.img,if=virtio,index=0 -boot c -net nic -net user -nographic -vnc :0
At this point, you can add all the packages you want to have installed, update the installation, add users and make any configuration changes you want in your image.
