Windows Development Environment Setup ===================================== This document outlines the steps I take to setup my environment on windows using WSL. This requires being on the windows 10 Creative update or greater with Ubuntu 16 installed as WSL. # Windows Setup 1. Install [WSL](https://msdn.microsoft.com/en-us/commandline/wsl/install_guide) 2. Install [Terminus](https://github.com/Eugeny/terminus) and setup to use bash for windows. 3. Install [Acrylic DNS Proxy](http://mayakron.altervista.org/wikibase/show.php?id=AcrylicHome) 4. Download [WSL Startup Scripts](https://gist.github.com/valeryan/588856aea1f8ea64792a2cd3f5e4b426) 5. Install [Xming](https://sourceforge.net/projects/xming/) (optional) # WSL Setup 1. Open Terminus. 2. Run `sudo visudo`. 3. Add `ALL ALL = (root) NOPASSWD: /usr/sbin/service` and `username ALL=(ALL) NOPASSWD: ALL` to sudoer config. 4. Run `sudo add-apt-repository ppa:ondrej/php`. 5. Run `sudo apt-get update && sudo apt-get upgrade` 6. Run `sudo apt-get install libnss3-tools jq xsel build-essential libssl-dev dnsmasq nginx mysql-server php-fpm php-cli php-mysql php-sqlite3 php-intl php-zip php-xml php-curl php-mbstring redis-server php-redis` 7. Run `sudo usermod -d /var/lib/mysql/ mysql` ### Node 2. Run `curl -sL https://deb.nodesource.com/setup_6.x -o nodesource_setup.sh`. 3. Run `sudo bash nodesource_setup.sh` 4. Run `sudo apt-get install nodejs` ### Yarn 1. Run `curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -`. 2. Run `echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list`. 3. Run `sudo apt-get update && sudo apt-get install yarn`. ### Composer 1. Run `wget https://getcomposer.org/installer` 2. Run `php installer` 3. Run `sudo mv composer.phar /usr/local/bin/composer` 4. Run `vi ~/.composer/composer.json` ### Composer Global Install 1. Add: ``` { "require": { "valeryan/valet-wsl": "dev-master", "squizlabs/php_codesniffer": "*", "laravel/installer": "^1.3" }, "repositories": [ { "type": "vcs", "url": "git@github.com:valeryan/valet-wsl.git" } ] } ``` 2. Run `composer global update` ### Bash Config 1. Run `vi .bash_aliases`. 2. Add `export PATH=~/.composer/vendor/bin:$PATH`. 3. Also if you want to use Gui application via Xming add `export DISPLAY=:0.0`. (optional) 3. Run `source .bashrc`. ### Acrylic Setup (Windows) 1. In Windows hit the **windows key** and search for Acrylic and find **Edit Acrylic Host File**. 2. Add `127.0.0.1 *.dev` to bottom of file and save. 3. Hit the **windows key** again and search for **Stop Acrylic Service**. 4. Search again for **Start Acrylic Service**. ### Valet Setup (WSL) 1. Run `valet install`. 2. Browse to a laravel project folder and run `valet park`, `valet link`, `valet restart`. 3. To test, browse to **folder.dev**. 4. In WSL and in project folder run `valet secure`. ### Valet Setup (Windows) 1. In Windows Explorer browse to **C:/tools/valet/certs/** and double click the **install_certs.cmd** file. This will install any certs in the folder as trusted root certificates. 7. Refersh your browser and see if HTTPS in enabled and valid. You may need to restart valet and your browser to get everything in sink. ### WSL Startup (Windows) 1. Move the WSL startup scripts you downloaded earlier to **C:/tools/wsl-startup/**. 2. Make any adjustments to **services.sh**. 3. Create a Task Scheudule to run **bash-start.vbs** at logon. 4. Reboot to test startup. You should be able to browse to any valet configured sites after reboot. ## Optional ### Install Diff Tool 1. Run `sudo apt-get install dbus-x11 meld`. ### Setup Cron For Projects 1 Run `sudo crontab -e`. #### Crontab Setup Example ``` */5 * * * * php /mnt/c/username/shils/Documents/Projects/folder/artisan schedule:run >> /dev/null 2>&1 ```