Thursday, December 2, 2010

KVM Streamliner

Machine virtualization can be done quite simply on Linux.

First check the hardware with kvm-ok:

$ kvm-ok
INFO: Your CPU supports KVM extensions
INFO: /dev/kvm exists
KVM acceleration can be used

Next, create a couple disk images with qemu-img:

$ qemu-img create -f raw d0.raw 8G
Formatting 'd0.raw', fmt=raw size=8589934592
$ qemu-img create -f raw swap.raw 2G
Formatting 'swap.raw', fmt=raw size=2147483648

Setup a 'usermode' network interface with tunctl:

$ sudo /usr/sbin/tunctl -t tap7
Set 'tap7' persistent and owned by uid 0

Enjoy!:

$ sudo kvm -M pc -m 1024 -smp 1 -name streamliner -monitor pty \
-cdrom ubuntu-10.10-server-amd64.iso \
-drive file=d0.raw,if=virtio,boot=on \
-drive file=swap.raw,if=virtio \
-net nic,macaddr=52:54:00:d0:bb:27,model=virtio \
-net tap,script=no,ifname=tap7 \
-vnc 127.0.0.1:7
char device redirected to /dev/pts/3

Simple, too simple, yes? How about cracking open a vnc client and installing from the boot iso? (f4 -> virtual):

$ xvncviewer 127.0.0.1:7

Also, one can poke the soft underbelly via serial 'port':

$ sudo minicom -o -p pts/3

Well, that's all for now folks. Next time I'll write about a simple network setup.

No comments:

Post a Comment