Skip to content

Running OSv image under KVM QEMU

dorlaor edited this page Feb 10, 2014 · 17 revisions

Install dependencies

On Fedora:

sudo yum install libvirt

On Debian:

sudo apt-get install libvirt0

Download OSv image

wget http://downloads.osv.io.s3-website-us-east-1.amazonaws.com/qemu/osv-v0.04.qcow2

Create a KVM/QEMU networking bringup script

#make sure you have a bridge or create a bridge and name it
#http://www.lainoox.com/bridge-brctl-tutorial-linux/

cat > qemu-ifup.sh << EOF
#!/bin/sh
#!/bin/sh
export OSV_BRIDGE=virbr0
brctl stp \$OSV_BRIDGE off
brctl addif \$OSV_BRIDGE \$1
ifconfig \$1 up
EOF
chmod u+x qemu-ifup.sh

Start OSv under QEMU

sudo qemu-system-x86_64 -vnc :1 -gdb tcp::1234,server,nowait -m 2G -smp 2 \
  -chardev stdio,mux=on,id=stdio -mon chardev=stdio,mode=readline,default \
  -device isa-serial,chardev=stdio -drive file=osv-v0.04.qcow2,if=virtio,cache=unsafe \
  -netdev tap,id=hn0,script=qemu-ifup.sh,vhost=on -device virtio-net-pci,netdev=hn0,id=nic1 \
  -device virtio-rng-pci -enable-kvm -cpu host,+x2apic
Clone this wiki locally