# create disk
$ qemu-img create -f qcow2 ~/QEMU/ubuntu-desktop-18.04.qcow2 10G
# setup
$ qemu-system-x86_64 -m 2048 -vga virtio -show-cursor -usb -device usb-tablet -enable-kvm -cdrom ~/QEMU/ubuntu-18.04.2-desktop-amd64.iso -drive file=~/QEMU/ubuntu-desktop-18.04.qcow2,if=virtio -accel hvf -cpu host
# run (unmount CDROM)
$ qemu-system-x86_64 -m 2048 -vga virtio -show-cursor -usb -device usb-tablet -enable-kvm -drive file=~/QEMU/ubuntu-desktop-18.04.qcow2,if=virtio -accel hvf -cpu host
good read @ https://graspingtech.com/ubuntu-desktop-18.04-virtual-machine-macos-qemu/
disclaimer: after trying a bunch of options, Samba ultimately worked best & simplest despite the non-trivial complexity associated with getting it working. if you know a better option, please lmk @thomaswilley!
-
compile samba b/c the default osx-edition of smbd is incompatible https://gist.github.com/thomaswilley/ffcdb83c21c782cbab8a18d6134f87d7
-
be sure you ran $ make install; then lazily run the following (lazily b/c I did a $ brew install qemu rather than compile from src and if I'd compiled from src I'dve just set the smb path to its install loc..
$ mkdir /usr/local/sbin
$ sudo ln -s /opt/samba/sbin/smbd /usr/local/sbin/smbd
$ sudo mkdir /usr/local/sbin
$ sudo ln -s /opt/samba/bin/smbd /usr/local/sbin/samba-dot-org-smbd
$ qemu-system-x86_64 -m 2048 -vga virtio -show-cursor -usb -device usb-tablet \
-enable-kvm -drive file=absolute-path-to-ubuntu-desktop-18.04.qcow2,if=virtio \
-accel hvf -cpu host \
-device virtio-net,netdev=vmnic \
-netdev user,id=vmnic,smb=path-on-hostmachine-to-share-with-guestmachine
w/in the guest os, mount the samba share:
$ sudo mkdir /mnt/share
$ sudo mount -t cifs -o user=your-user-at-host.local //10.0.2.4/qemu /mnt/share
if you want it to be persistent, copy the last line of /etc/mtab and append it to /etc/fstab.
note that when you $ sudo shutdown -r now; or otherwise reboot, QEMU can sometimes look as though it's frozen (while trying to mount the location). If this happens, just click into the QEMU VM so it captures your inputs and go ahead and type (into oblivion) the password you typed during the $ sudo mount ...; process and then a carriage return. It should boot right up.