My 1st task at Neontribe was to set up my Windows development environment for Lavarel PHP-powered service that exposes a website and an API.
Most developers here at Neontribe use Linux so as I was using Windows I expected a few issues to surface. Indeed, having chosen to use the Lavarel Homestead VM for simplicity, I found several sticking points not covered in the installation notes. Here's the steps you need to cover to get Homestead setup on Windows
- Ensure virtualisation is enabled in the BIOS
- Ensure hyper-v is not enabled in (
Turn Windows features on or off) as you can only use a single Hypervisor and Homestead uses VirtualBox
- Ensure Bitdefender
Settings -> Advanced -> scan hosts fileoption is off. Otherwise it'll comment out any lines you add.
- Follow these instructions to install Homestead and optionally Heidi. Note you can use the latest VirtualBox and Vagrant. Don't forget to edit the hosts file as administrator.
vagrant plugin install vagrant-winnfsdto install nfs support and add
type: nfsto any folder mapping in
Homestead.yaml. This can significantly boost performance.
- Adjust the Folders sections in the
Homestead.yamlfile to be of this form:
folders: - map: ~/Projects/onesite-dev to: /home/vagrant/code/onesite-dev type: nfs sites: - map: onesite.dev to: /home/vagrant/code/onesite-dev/public
vagrant reload --provision
- Optionally set
export VAGRANT_CWD=/c/Users/Fred/projects/homesteadin your
.bashrcso that Vagrqant will work in any directory
vagrant up to launch Homestead, followed by
vagrant ssh to run any additional setup or installation steps in the Homestead VM environment.
As the folder mappings ensure the project source code is shared between Windows and Homestead you can also run your favourite editor and
git editor in Windows rather than the Homestead VM ssh, eg using Git 4 Windows' bash shell. Just remember to make sure your editor and git configuration do not add 'CR' chars to end of lines and push them.