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 Terminus and setup to use bash for windows (optional).
- Install Acrylic DNS Proxy.
- Download WSL Startup Scripts.
- Install Xming (optional).
- Open a bash instance in a terminal.
- Run sudo visudo.
- Add ALL ALL = (root) NOPASSWD: /usr/sbin/serviceandusername ALL=(ALL) NOPASSWD: ALLto sudoer config.
- Run sudo apt-get install software-properties-common
- 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 zip unzip dnsmasq nginx mariadb-server php-fpm php-cli php-mysql php-sqlite3 php-intl php-zip php-xml php-curl php-mbstring redis-server php-redis php-pear php-dev pkg-config libz-dev libzip-dev libmemcached-dev libmemcached11 libmemcachedutil2 libmagickwand-dev imagemagick memcached
I ran into some issues with MySql not having a password and not being able to get mysql_secure_installation to work. As a workaround I used mysqladmin.
3. Run sudo service mysql start
2. Run sudo mysql_secure_installation
3.
$ sudo mysql -u root # I had to use "sudo" since is new installation
mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;
$ sudo service mysql restart
- nano /etc/nginx/nginx.conf
- Add fastcgi_buffering off;andfastcgi_keep_conn on;
- Run curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh.
- Run sudo bash nodesource_setup.sh.
- Run sudo apt-get install nodejs.
- Run curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -.
- Run echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list.
- Run sudo apt-get update && sudo apt-get install yarn.
- Run wget https://getcomposer.org/installer.
- Run php installer.
- Run sudo mv composer.phar /usr/local/bin/composer.
- Run curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
- Run php wp-cli.phar --infoto check its working
- Run chmod +x wp-cli.phar
- Run sudo mv wp-cli.phar /usr/local/bin/wp
- Run composer global require valeryan/valet-wsl.
- Run vi ~/.bash_aliases.
- Add export PATH=~/.composer/vendor/bin:$PATH.
- Also if you want to use Gui application via Xming add export DISPLAY=:0.0. (optional)
- Run source ~/.bashrc.
- In Windows hit the windows key and search for Acrylic and find Edit Acrylic Host File.
- Add 127.0.0.1 *.devto 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.