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 an Ubuntu 16 installed as WSL.
- Install WSL.
- Install Hyper and setup to use bash for windows (optional).
- Install Acrylic DNS Proxy.
- Download WSL Startup Scripts.
- Open a bash instance in a terminal.
- Run
sudo visudo
. - Add
ALL ALL = (root) NOPASSWD: /usr/sbin/service
andusername ALL=(ALL) NOPASSWD: ALL
to sudoer config. - Run
sudo add-apt-repository ppa:ondrej/php
. - Run
sudo apt-get update && sudo apt-get upgrade
- Run
sudo apt-get install network-manager 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
- Run
sudo usermod -d /var/lib/mysql/ mysql
- Run
$ sudo mysql -u root mysql> USE mysql mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root'; mysql> FLUSH PRIVILEGES; mysql> exit; $ mysql -u root mysql> SET PASSWORD FOR root@'localhost' = PASSWORD('root'); mysql> exit;
- Make sure you have pip installed.
- Run
sudo pip install nodeenv
- Run
wget https://getcomposer.org/installer
. - Run
php installer
. - Run
sudo mv composer.phar /usr/local/bin/composer
. - Run
vi ~/.composer/composer.json
.
- Run
composer global require valeryan/valet-wsl
.
- Run
vi ~/.bash_aliases
. - Add
export PATH=~/.composer/vendor/bin:$PATH
. - Run
source ~/.bashrc
.
- In Windows hit the windows key and search for Acrylic and find Edit Acrylic Host File.
- Add
127.0.0.1 *.dev
to bottom of file and save. - Hit the windows key again and search for Stop Acrylic Service.
- Search again for Start Acrylic Service.
- Run
valet install
. - Run
valet domain dev
. (optional: defaults to .test and my preference is .dev) - Browse to a laravel project folder and run
valet link
. - To test, browse to folder.dev.
- In WSL and in project folder run
valet secure
.
- 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.
- 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.
- Move the WSL startup scripts you downloaded earlier to C:/tools/wsl-startup/.
- Make any adjustments to services.sh.
- Create a Task Scheudule to run bash-start.vbs at logon.
- Reboot to test startup. You should be able to browse to any valet configured sites after reboot.
- Add
fastcgi_buffering off;
to the nginx fcgi conf.
- Run
sudo crontab -e
.
*/5 * * * * php /mnt/c/username/Projects/folder/artisan schedule:run >> /dev/null 2>&1