This document describes how to set up Windows 10 for cross-platform development (Go, NodeJS, etc) with Windows Subsystem for Linux (WSL).
Most of the information here is collected from
- Download Brave beta and Firefox browsers, make either default.
- Install 1Password for Windows, sign into personal and company accounts.
- Add 1Password X extension in Brave and Firefox
- Enable WSL and install latest version of Ubuntu from Microsoft Store
- Create C:\home directory, move user's home folder there and update
/etc/passwd
with the new location
# in /etc/wsl.conf
# Enable extra metadata options by default
[automount]
enabled = true
options = "metadata,umask=22,fmask=11"
mountFsTab = true
Ubuntu will create a default user on the initial run. It can also be done manually:
- Create new user in Ubuntu:
useradd -Um roustem
- Make sure that user is added to
sudoers
- Change default user (using PowerShell Admin):
ubuntu config --default-user roustem
sc stop LxssManager
sc start LxssManager
sudo apt update
sudo apt upgrade
sudo apt remove gnupg gpg
sudo apt install gnupg2 fish tree graphviz build-essential unzip
export GO_VERSION=1.11.4
curl -O "https://dl.google.com/go/go$GO_VERSION.linux-amd64.tar.gz"
sudo mv /usr/local/go /usr/local/go.bak.$GO_VERSION # if installing new version
sudo tar -C /usr/local -xzf go$GO_VERSION.linux-amd64.tar.gz
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt -get install -y nodejs
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update
sudo apt-get install yarn
# Export key to `key.asc` file and then import
gpg --import key.asc
# or add --pinentry-mode if there is ap problem with entering the password
gpg --import --pinentry-mode loopback key.asc
git config --global commit.gpgsign true
git config --global user.signingkey E25C1E01F3A98447
git config --global gpg.program /usr/bin/gpg
git config --global user.email [email protected]
git config --global user.name Roustem
git config --global url."[email protected]:".insteadOf "https://gitlab.1password.io/"
git config --global url."[email protected]:".insteadOf "[https://gitlab.com](https://gitlab.com)"
Debugging gpg signing:
echo “Test” | gpg --clear-sign
https://cloud.google.com/sdk/docs/downloads-apt-get
sudo apt install kubectl
gcloud init
gcloud container clusters get-credentials cluster-dev
- Visual Studio Code
- Git
- Go
- WSLtty
- Gpg4win
- Ditto
After installing Go, press Win-S
, type PATH
and change the GOPATH
to C:\home\roustem\go
. This will make sure that GOPATH is shared with WSL and Go can pickup all libraries and vendored code.
git config --global gpg.program "C:\Program Files (x86)\GnuPG\bin\gpg.exe"
git config --global commit.gpgsign true
git config --global user.signingkey E25C1E01F3A98447
git config --global user.email [email protected]
git config --global user.name Roustem
git config --global core.filemode false
git config --global core.autocrlf input
Also, make sure that local .git/config
file has correct settings as well.
Note: you might have to do this without --global
in the repo as well.
Install MinGW to get access to make and other command line tools. Update PATH to Include
C:\MinGW\bin
C:\MinGW\msys\1.0\bin
Based on Speeding up WSL I/O ..., turn off Windows Defender protection for some folders and processes:
Exclude folder: %USERPROFILE%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
Exclude processes:
- git
- node
- npm
- dpkg
- go
WSL Interoperability with Docker
go get -d github.com/jstarks/npiperelay
// on Windows:
go install github.com/jstarks/npiperelay
// in WSL:
sudo apt install socat
sudo apt install docker.io
touch ~/docker-relay
chmod +x ~/docker-relay
vim ~/docker-relay
// contents of ~/docker-relay
#!/bin/sh
exec socat UNIX-LISTEN:/var/run/docker.sock,fork,group=docker,umask=007 EXEC:"npiperelay.exe -ep -s //./pipe/docker_engine",nofork
// end ^^^
sudo adduser roustem docker
Set keyboard shortcut to Alt-V
Exclude 1Password
binary
Add image clipboard type
Keyboard Shortcuts:
-
Cmd-Shift-S
– take a screenshot and save it to clipboard -
Win-.
– show emoji panel (see Advanced Keyboard settings to control if emoji panel closes automatically) Configure system and user path: -
Win-S
, type "PATH" Configure taskbar: -
Cmd-S
, type "system icons"