Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sskras/7610f305d4e4e1be2072b52e25405f17 to your computer and use it in GitHub Desktop.
Save sskras/7610f305d4e4e1be2072b52e25405f17 to your computer and use it in GitHub Desktop.
Setup KVM/Qemu on OpenIndiana
#!/bin/sh
# See: http://wiki.openindiana.org/oi/7.3+KVM
export NIC=e1000g0 #Change as needed see output of ifconfig
pkg install driver/i86pc/kvm system/qemu system/qemu/kvm
#Change vnic0 as needed
dladm create-vnic -l $NIC vnic0
export MAC=$(dladm show-vnic -po macaddress vnic0)
export ISO=/path/to/some/cdimage.iso
export GUESTNAME=aur4.zoelife4u.org
export MEMSIZE=2048 # In MB
# Change as needed based off ZFS config:
# Make sure the disk size is correct...
zfs create -p -V 10G rpool/kvm/$GUESTNAME/disk0
# Change as needed:
pfexec /usr/bin/qemu-kvm \
-boot cd \
-enable-kvm \
-vnc 0.0.0.0:1 \
-smp 2 \
-m $MEMSIZE \
-no-hpet \
-localtime \
-drive file=/dev/zvol/rdsk/rpool/kvm/$GUESTNAME/disk0,if=ide,index=0 \
-drive file=$ISOFILE,media=cdrom,if=ide,index=2  \
-net nic,vlan=0,name=net0,model=e1000,macaddr=$MAC \
-net vnic,vlan=0,name=net0,ifname=vnic0,macaddr=$MAC \
-vga std
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment