Ever wondered how Vagrant shared folders work in the background with NFS on a Mac host?
It's pretty straight forward, so let's dive in.
Step1. Mac Host:
- supposing that you are using VirtualBox, just add a Host-Only interface to the Ubuntu/Debian Guest VM, usually the Host-Only interface has the following gateway IP
Step2. Ubuntu/Debian Guest VM:
- Add the followings to
auto eth1 iface eth1 inet static address 192.168.33.120 netmask 255.255.255.0
cd ~ mkdir myWebApp
cd ~/Sites mkdir myWebApp
- Then add to
"/Users/yourMacUser/Sites/myWebApp" 192.168.33.120 -alldirs -mapall=501:20
- Then restart nfsd with
sudo nfsd restart
sudo mount -t nfs 192.168.33.1:"/Users/yourMacUser/Sites/myWebApp" ~/myWebApp
You should now see your Mac Host folder
/Users/yourMacUser/Sites/myWebApp content mounted into your Ubuntu/Debian Guest folder
Let us know what you think.