tl;dr: Setting up a VM with symlinks inside shared folders is now pretty easy!
I recently purchased a Windows machine with one of the primary goals being to increase PuPHPet's support for Windows OS. On the roadmap is Hyper-V support, but right now I am picking low hanging fruit.
The first thing I fixed was Window's pesky line endings messing up shell scripts. Bash would fall apart
when attempting to run scripts that contained
\r\n. This usually happened when a Windows user would
edit a file using an editor that had not been configured to always use
A simple call to
sed fixed this fairly quickly.
Symlinks in Shared Folders
The next thing had been a thorn in my side for some time. Unfortunately, not having a Windows machine handy forced me to keep putting this off, until now.
Some packages like Apache on CentOS attempt to create symlinks in the
/var/www directory. Since Windows
doesn't have native support for Linux-style symlinks, this would fail and break provisioning.
The solution was not very easy to find, but thanks to some very helpful people I was finally able to get this working properly.
The first step is installing Polsedit - User Policies Editor. When you open it, look for Create symbolic links.
Double click the row, click Add User or Group... and look for your username in the list. Closing the app will automatically save your choices, and you'll need to reboot your machine.
You will only need to do this one time.
After rebooting, the only step you must keep in mind is to always run Vagrant via "Run as administrator".
You can accomplish this by running
cmd.exe (or, preferably, Cygwin) with
That's it! The code that runs the magic is here.
- Download Polsedit and add your user to the
- Always run
cmd.exewith "Run as administrator".
Here's some proof!
Have fun, learn something!