Vagrant and NFS on Windows 7
In March this year, I and my colleagues from PH Lucerne attended a TYPO3 Flow and Neos workshop with Robert Lemke in Zurich. I've followed the development of the latest TYPO3 projects with great interest for the past few years and the planned relaunch for our Intranet solution, now called PHLUportal, seemed like a great opportunity to get into Flow development.
At PH Lucerne, we're working on a Windows 7 Client with local admin privileges. Most of us have used the XAMPP environment for local development, but never have been content with its speed and the fact that we developed web applications on a Windows server that would run on Linux servers afterwards. Now that we would be working together on a Flow project, we decided to move to Vagrant for local development.
The base for our own Vagrant box was the TYPO3 Flow Vagrant Box from Thomas Layh that helped me getting into the Vagrant world. I extended the box with some specific requirements such as Shibboleth authentication for Switch AAI and a Phing script to copy database and file resources from the Live server. The only problem that remained was a fast way to access the filesystem from Windows.
Vagrant has a feature called "synced folders" that has an option to share a folder by using the NFS protocol. Unfortunately, synced NFS folders are disabled on Windows because - as Vagrant's website states - "NFS folders do not work on Windows hosts". Using SMB/CIFS works fine, but it is painfully slow.
But there are ways around that problem. Windows 7 Ultimate and Enterprise have a built-in NFS Client, however it is disabled by default. There is a blog post explaninig how it can be activated. To avoid problems with permissions, you also should change the anonymous user id (to the id of the user vagrant, default: 1000) and group id (to the id of www-data, default: 33) for the NFS client in the registry. You can also just use this registry file. After changing the registry, you need to restart the NFS client:
nfsadmin client stop nfsadmin client start
To enable NFS on your server, you need to install a NFS server. Luckily you can use the NFS cookbook for that purpose. Add it to the list of cookbooks, run the recipe it in your site recipe and configure the shared folder path:
include_recipe "nfs" include_recipe "nfs::server" nfs_export "/exports" do network '*' writeable true sync true directory '/var/www/typo3.flow' anonuser 'vagrant' anongroup 'www-data' options ['no_subtree_check'] end # restart nfs server execute "restart nfs server" do command "/etc/init.d/nfs-kernel-server restart" end
That's it! You now have the share available in your Windows host. You can mount it to a drive letter using the mount command:
mount 192.168.23.3:/var/www/typo3.flow Z:












