Setting up an OS X host with an Ubuntu Virtual Machine
I enjoy working with OS X however Ubuntu is great for setting up a server quickly with modern packages.
I use VirtualBox to run my Virtual Machine.
Ubuntu packages I use for PHP / MySQL development:
`sshfs mysql-server-5.7 apache2 php7.0 libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0-xml php7.0-zip`
I’ve found running my code on OS X best for quickly allowing my IDE to edit it. I then use sshfs to mount the OS X machine from inside the Ubuntu VM.
On the OS X Host:
Add your SSH key from the Ubuntu Virtual machine to your authorized_keys file:
On the Ubuntu VM:
Edit /etc/fuse.conf and uncomment:
sshfs -o cache_timeout=5 -o idmap=user -o allow_other -o gid=33 -o uid=33 USER_NAME@HOST:/HOST/PATH /LOCAL/PATH
I’m using user id 33, that’s the user id of the www-data user on my Ubuntu VM. You can find that out easily with:
id -u www-data
I find for my Symfony projects it’s better to put the cache and log directory in another location on the Virtual Machine.
mkdir -p ~/sites/PROJECT_NAME