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.

  1. Install kvm if you don't have it already:
    sudo aptitude install kvm
  2. create your disk image:
    qemu-img create -f qcow2 ubuntu.qcow2 100G
  3. 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):
    kvm -soundhw all -cdrom ~/downloads/ubuntu-8.04-desktop-i386.iso -localtime -m 512 -hda ubuntu.qcow2 -boot d
    All of these command-line options are explained in the qemu man-page.
  4. Now just run through the install as normal.
  5. 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

Anonymous said…
A nice straight forward guide, just what i needed!
Thanks.
Anonymous said…
THANK YOU SO MUCH !
Simple! Straitforward! What I do look for..
KVM Switches said…
I’ve been checking out this blog it’s been really helpful. I was not understanding what I was doing. But your blog helped me a lot. Thank you very much and all the best in future.

Popular posts from this blog

SystemVerilog Fork Disable "Gotchas"

'git revert' Is Not Equivalent To 'svn revert'

SystemVerilog Streaming Operator: Knowing Right from Left