Setting up an OS to work with xhyve can be a bit tricky, but it's not imppossible. These intructions should be generally applicable to most versions of Linux.
Xhyve will use a file as a logical disk. Be sure you have the filesize you need, because growing the file later is tricky to impossible (you could try to use qcow
or similar to get around this, but qcow volumes can be tricky to mount).
dd if=/dev/zero of=hdd.img bs=1g count=32 # Create a 32 gig disk. Raise 'count' as desired
Xhyve loads the kernel and initrd images from the local filesystem -- you'll need to get these from a mounted iso in order to boot an install cd. First download an iso. You probably want to use the mini.iso.
Once downloaded, you'll need mount it and copy off the kernel files. But these isos are not directly mountable in osx. To make them mountable, you'll need to make a compatible copy and then mount the copy:
dd if=/dev/zero bs=2k count=1 of=tmp.iso
dd if=mini.iso bs=2k skip=1 >> tmp.iso
hdiutil attach tmp.iso
Next copy the kernel files from the mounted volume
cp /Volumes/CDROM/linux .
cp /Volumes/CDROM/initrd.gz .
You can now boot into an installer. Run the attached install.sh
script. Follow the prompts. However, once tghe installation is complete -- do not reboot. Select Go Back
and then Execute a shell
. We are going to use nc to copy off the system inird and linux kernel. At the shell prompt:
cd /target
sbin/ifconfig
tar c boot | nc -l -p 1234
Make note of the ip returned from ifconfig. On your osx host:
nc <IP from above> 1234 | tar x
This should drop the latest boot images (kernel, initrd) into the boot/
subdirectory.
You should be able to boot up the new machine using the run.sh
script below. Note that you will probably need to replace the exact filenames used for LINUX and INITRD with whatever you downloaded in boot/
in the previous step. The console is a little wonky -- in general, I install openssh when I am installing ubuntu, and use that to finish setting up the new vm after booting it up.