Skip to content

Instantly share code, notes, and snippets.

@steffen-wirth
Forked from valeryan/WindowsSetup.md
Created January 10, 2018 14:38
Show Gist options
  • Save steffen-wirth/9ee017315925f9df454e63e549d5521b to your computer and use it in GitHub Desktop.
Save steffen-wirth/9ee017315925f9df454e63e549d5521b to your computer and use it in GitHub Desktop.
Local WSL Setup

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
  2. Install Terminus and setup to use bash for windows.
  3. Install Acrylic DNS Proxy
  4. Download WSL Startup Scripts
  5. Install 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 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
  7. Run sudo usermod -d /var/lib/mysql/ mysql

Node

  1. Run curl -sL https://deb.nodesource.com/setup_8.x -o nodesource_setup.sh.
  2. Run sudo bash nodesource_setup.sh
  3. 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"
    },
    "repositories": [
        {
            "type": "vcs",
            "url":  "git@github.com:valeryan/valet-wsl.git"
        }
    ]
}
  1. 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)
  4. 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. Run valet domain dev. (optional: defaults to .test and my preference is .dev)
  3. Browse to a laravel project folder and run valet link.
  4. To test, browse to folder.dev.
  5. 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.
  2. 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment