Running OSv image under KVM QEMU

rizaudo edited this page Jul 12, 2014 · 17 revisions

Install dependencies

On Fedora:

sudo yum install libvirt

On Debian:

sudo apt-get install libvirt0

Download OSv image

Download the latest QCOW2 image for KVM from here

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
export OSV_BRIDGE=virbr0
brctl addif \$OSV_BRIDGE \$1
brctl stp \$OSV_BRIDGE off
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
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.