Skip to content

Instantly share code, notes, and snippets.

@mcharo
Last active April 19, 2019 02:21
Show Gist options
  • Save mcharo/30744aed93becccdefcc96b558f14f0d to your computer and use it in GitHub Desktop.
Save mcharo/30744aed93becccdefcc96b558f14f0d to your computer and use it in GitHub Desktop.
Ubuntu on xhyve
# build xhyve
git clone https://github.com/mist64/xhyve
cd xhyve
make
# dump ubuntu iso to ./xhyve/ubuntu
mkdir ubuntu
cd ubuntu
wget http://releases.ubuntu.com/14.04.2/ubuntu-14.04.2-server-amd64.iso
dd if=/dev/zero bs=2k count=1 of=/tmp/tmp.iso
dd if=ubuntu-14.04.2-server-amd64.iso bs=2k skip=1 >> /tmp/tmp.iso
hdiutil attach /tmp/tmp.iso
cp /Volumes/Ubuntu-Server\ 14/install/vmlinuz .
cp /Volumes/Ubuntu-Server\ 14/install/initrd.gz .
dd if=/dev/zero of=hdd.img bs=1g count=8
# move back to top-level xhyve folder
cd ..
# create script to run ubuntu installer
cat <<\EOF > .\xhyverun_ubuntu_install.sh
#!/bin/sh
KERNEL="ubuntu/vmlinuz"
INITRD="ubuntu/initrd.gz"
CMDLINE="earlyprintk=serial console=ttyS0 acpi=off"
MEM="-m 1G"
#SMP="-c 2"
NET="-s 2:0,virtio-net"
IMG_CD="-s 3,ahci-cd,ubuntu/ubuntu-14.04.2-server-amd64.iso"
IMG_HDD="-s 4,virtio-blk,ubuntu/hdd.img"
PCI_DEV="-s 0:0,hostbridge -s 31,lpc"
LPC_DEV="-l com1,stdio"
build/xhyve $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD -f kexec,$KERNEL,$INITRD,"$CMDLINE"
EOF
# run text-mode ubuntu installer
sudo ./xhyverun_ubuntu_install.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment