KVM in Ubuntu Hardy Heron
Apparently there are some new gui apps for running and interacting with KVM on Ubuntu 8.04. After reading those two blog entries, I fired up virt-manager and virt-install, and wasn't very impressed. I didn't like the idea of piping the graphics through VNC when all I want is to run a virtual machine on my local desktop. And why do you need a confusing GUI when the command-line utilities for kvm/qemu are so straightforward?
Now that I've said that, I'll point you at this overly complex KVM guide just so you can follow the first part to check if your CPU supports hardware virtualization. I would pretty much ignore the rest of that guide. Oh, and if your CPU doesn't support hardware virtualization, you can pretty much replace kvm with qemu in all the below steps and this will still work, just slower.
Allright, here's how I set up a new KVM instance on my Ubuntu Hardy Heron box. I installed Hardy on the virtual machine in this example, but you could just as easily do windoze or about any other OS of your choosing.
- Install kvm if you don't have it already:
sudo aptitude install kvm
- create your disk image:
qemu-img create -f qcow2 ubuntu.qcow2 100G
- Specify the Ubuntu install CD image as your cdrom drive and tell kvm to boot from that with
-boot d
, with ubuntu.qcow2 as your hard drive (also enable sound hardware and use-localtime
, though I think localtime is only needed for windoze to get the time right):
All of these command-line options are explained in the qemu man-page.kvm -soundhw all -cdrom ~/downloads/ubuntu-8.04-desktop-i386.iso -localtime -m 512 -hda ubuntu.qcow2 -boot d
- Now just run through the install as normal.
- When that's done, boot up your new system like so:
kvm -soundhw all -cdrom /dev/cdrom -localtime -m 512 -hda ubuntu.qcow2
There you have it. I highly suggest putting that last command in a file and making it executable so you can just run it as a script.
Comments
Thanks.
Simple! Straitforward! What I do look for..