A quick reminder to myself.
To disable the GUI in Ubuntu (i.e. to run it as a headless VM), do the following:
sudo vim /etc/default/grub
Change: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" to GRUB_CMDLINE_LINUX_DEFAULT="text"
save, then run: sudo update-grub and restart.
To enable gui again, just change from text to quiet splash.