edoceo

How To: Ubuntu as a KVM Host

Install Jaunty and select the Virtual Host Server option during install. After install ensure that sudo apt-get install iotop mdadm python-virtinst python-vm-builder qemu sysstat uml-utilities is run. As well as apt-get update && apt-get upgrade.

Prepare LVM for System Images

First create a partition, or possibly a device at /dev/md0 to put LVM on top of.

# or
cfdisk /dev/sdb
# or
mdadm --create --level=raid1 --num-devices=2 /dev/md0 /dev/sda1 /dev/sdb1

Now create LVM on top of this raid device

# then
pvcreate /dev/md0
# and create volume group on top
vgcreate --physicalextentsize 16M vg0 /dev/md0
# now make a volume in that group
lvcreate --name lv0 --size 8G vg0
# and format it
mke2fs -j -L 'vm0-root' /dev/vg0/lv0

Preparing for a Virtual Guest

Create a Bridged Network Interface

brctl addbr br0
brctl addif br0 eth0
tunctl -t tap0
brctl addif br0 tap0
ifconfig tap0 up 0.0.0.0 promisc

Running a Virtual Guest

/usr/bin/kvm -m 512 -name vm0 -uuid b5e74b29-bcf6-eab2-681b-0acc4de3a6ef \
  -drive file=/dev/vg0/vm0-root,if=sd,index=0 \
  -drive file=/dev/cdrom,if=sd,media=cdrom,index=2 \
  -net nic,vlan=0,macaddr=54:52:00:3a:c7:a9 \
  -net tap,vlan=0,ifname=tap0,script=no,downscript=no \
  -vnc 5901 \
  -k en-us \
  -boot d \
  -daemonize

See Also

Loading Comments from Disqus...