├── .gitconfig ├── .gitignore ├── .profile ├── .tmux.conf ├── .zshrc ├── Brewfile └── README.md /.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = your-username 3 | email = your-email 4 | signingkey = your-gpg-signingkey 5 | [commit] 6 | gpgsign = true 7 | [core] 8 | autocrlf = true 9 | filemode = false 10 | [credential] 11 | helper = /mnt/c/Program\\ Files/Git/mingw64/libexec/git-core/git-credential-wincred.exe 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # VSCode 2 | .vscode -------------------------------------------------------------------------------- /.profile: -------------------------------------------------------------------------------- 1 | # ~/.profile: executed by the command interpreter for login shells. 2 | # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login 3 | # exists. 4 | # see /usr/share/doc/bash/examples/startup-files for examples. 5 | # the files are located in the bash-doc package. 6 | 7 | # the default umask is set in /etc/profile; for setting the umask 8 | # for ssh logins, install and configure the libpam-umask package. 9 | #umask 022 10 | 11 | # if running bash 12 | if [ -n "$BASH_VERSION" ]; then 13 | # include .bashrc if it exists 14 | if [ -f "$HOME/.bashrc" ]; then 15 | . "$HOME/.bashrc" 16 | fi 17 | fi 18 | 19 | # set PATH so it includes user's private bin if it exists 20 | if [ -d "$HOME/bin" ] ; then 21 | PATH="$HOME/bin:$PATH" 22 | fi 23 | 24 | # set PATH so it includes user's private bin if it exists 25 | if [ -d "$HOME/.local/bin" ] ; then 26 | PATH="$HOME/.local/bin:$PATH" 27 | fi 28 | 29 | # fix default permission in when creating something in windows /mnt 30 | if [[ "$(umask)" = "0000" ]]; then 31 | umask 0022 32 | fi 33 | 34 | eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) 35 | -------------------------------------------------------------------------------- /.tmux.conf: -------------------------------------------------------------------------------- 1 | # set Zsh as your default Tmux shell 2 | set-option -g default-shell /bin/zsh 3 | 4 | # Tmux should be pretty, we need 256 color for that 5 | set -g default-terminal "screen-256color" 6 | 7 | # Tmux uses a 'control key', let's set it to 'Ctrl-a' 8 | # Reason: 'Ctrl-a' is easier to reach than 'Ctrl-b' 9 | unbind C-b 10 | set -g prefix C-a 11 | bind-key C-a send-prefix 12 | 13 | # command delay? We don't want that, make it short 14 | set -sg escape-time 1 15 | 16 | # Set the numbering of windows to go from 1 instead 17 | # of 0 - silly programmers :| 18 | set-option -g base-index 1 19 | setw -g pane-base-index 1 20 | 21 | # Allow us to reload our Tmux configuration while 22 | # using Tmux 23 | bind r source-file ~/.tmux.conf \; display "Reloaded!" 24 | 25 | # Getting interesting now, we use the vertical and horizontal 26 | # symbols to split the screen 27 | bind | split-window -h 28 | bind - split-window -v 29 | 30 | set-option -g repeat-time 0 31 | 32 | # set status bar to bottom 33 | set-option -g status-position bottom 34 | 35 | # Vi copypaste mode 36 | set-window-option -g mode-keys vi 37 | bind-key -Tcopy-mode-vi 'v' send -X begin-selection 38 | bind-key -Tcopy-mode-vi 'y' send -X copy-selection 39 | 40 | # List of plugins 41 | set -g @tpm_plugins ' \ 42 | caiogondim/maglev \ 43 | tmux-plugins/tpm \ 44 | tmux-plugins/tmux-sensible \ 45 | tmux-plugins/tmux-resurrect \ 46 | tmux-plugins/tmux-continuum \ 47 | tmux-plugins/tmux-yank \ 48 | tmux-plugins/tmux-pain-control \ 49 | tmux-plugins/tmux-copycat \ 50 | tmux-plugins/tmux-open \ 51 | tmux-plugins/tmux-battery \ 52 | tmux-plugins/tmux-cpu \ 53 | tmux-plugins/tmux-prefix-highlight \ 54 | ' 55 | 56 | # keep this at the bottom 57 | run '~/.tmux/plugins/tpm/tpm' 58 | -------------------------------------------------------------------------------- /.zshrc: -------------------------------------------------------------------------------- 1 | # If you come from bash you might have to change your $PATH. 2 | export PATH=$HOME/bin:/usr/local/bin:$PATH 3 | 4 | # brew 5 | export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH" 6 | export MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH" 7 | export INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH" 8 | 9 | # Path to your oh-my-zsh installation. 10 | export ZSH="/home/$USER/.oh-my-zsh" 11 | 12 | # Set name of the theme to load --- if set to "random", it will 13 | # load a random theme each time oh-my-zsh is loaded, in which case, 14 | # to know which specific one was loaded, run: echo $RANDOM_THEME 15 | # See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes 16 | ZSH_THEME="robbyrussell" 17 | 18 | # Set list of themes to pick from when loading at random 19 | # Setting this variable when ZSH_THEME=random will cause zsh to load 20 | # a theme from this variable instead of looking in ~/.oh-my-zsh/themes/ 21 | # If set to an empty array, this variable will have no effect. 22 | # ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" ) 23 | 24 | # Uncomment the following line to use case-sensitive completion. 25 | # CASE_SENSITIVE="true" 26 | 27 | # Uncomment the following line to use hyphen-insensitive completion. 28 | # Case-sensitive completion must be off. _ and - will be interchangeable. 29 | # HYPHEN_INSENSITIVE="true" 30 | 31 | # Uncomment the following line to disable bi-weekly auto-update checks. 32 | # DISABLE_AUTO_UPDATE="true" 33 | 34 | # Uncomment the following line to change how often to auto-update (in days). 35 | # export UPDATE_ZSH_DAYS=13 36 | 37 | # Uncomment the following line to disable colors in ls. 38 | # DISABLE_LS_COLORS="true" 39 | 40 | # Uncomment the following line to disable auto-setting terminal title. 41 | # DISABLE_AUTO_TITLE="true" 42 | 43 | # Uncomment the following line to enable command auto-correction. 44 | # ENABLE_CORRECTION="true" 45 | 46 | # Uncomment the following line to display red dots whilst waiting for completion. 47 | # COMPLETION_WAITING_DOTS="true" 48 | 49 | # Uncomment the following line if you want to disable marking untracked files 50 | # under VCS as dirty. This makes repository status check for large repositories 51 | # much, much faster. 52 | # DISABLE_UNTRACKED_FILES_DIRTY="true" 53 | 54 | # Uncomment the following line if you want to change the command execution time 55 | # stamp shown in the history command output. 56 | # You can set one of the optional three formats: 57 | # "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd" 58 | # or set a custom format using the strftime function format specifications, 59 | # see 'man strftime' for details. 60 | # HIST_STAMPS="mm/dd/yyyy" 61 | 62 | # Would you like to use another custom folder than $ZSH/custom? 63 | # ZSH_CUSTOM=/path/to/new-custom-folder 64 | 65 | # Autostart TMUX 66 | ZSH_TMUX_AUTOSTART=true 67 | 68 | # Which plugins would you like to load? 69 | # Standard plugins can be found in ~/.oh-my-zsh/plugins/* 70 | # Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ 71 | # Example format: plugins=(rails git textmate ruby lighthouse) 72 | # Add wisely, as too many plugins slow down shell startup. 73 | plugins=( 74 | git 75 | ) 76 | 77 | source $ZSH/oh-my-zsh.sh 78 | 79 | # User configuration 80 | 81 | # export MANPATH="/usr/local/man:$MANPATH" 82 | 83 | # You may need to manually set your language environment 84 | # export LANG=en_US.UTF-8 85 | 86 | # Preferred editor for local and remote sessions 87 | # if [[ -n $SSH_CONNECTION ]]; then 88 | # export EDITOR='vim' 89 | # else 90 | # export EDITOR='mvim' 91 | # fi 92 | 93 | # Compilation flags 94 | # export ARCHFLAGS="-arch x86_64" 95 | 96 | # ssh 97 | # export SSH_KEY_PATH="~/.ssh/rsa_id" 98 | 99 | # Set personal aliases, overriding those provided by oh-my-zsh libs, 100 | # plugins, and themes. Aliases can be placed here, though oh-my-zsh 101 | # users are encouraged to define aliases within the ZSH_CUSTOM folder. 102 | # For a full list of active aliases, run `alias`. 103 | # 104 | # Example aliases 105 | # alias zshconfig="mate ~/.zshrc" 106 | # alias ohmyzsh="mate ~/.oh-my-zsh" 107 | 108 | export GPG_TTY=$(tty) 109 | export EDITOR='nvim' 110 | export TERM="xterm-256color" 111 | 112 | # antigen 113 | source /home/linuxbrew/.linuxbrew/share/antigen/antigen.zsh 114 | 115 | # Load the oh-my-zsh's library. 116 | antigen use oh-my-zsh 117 | 118 | # Bundles from the default repo (robbyrussell's oh-my-zsh). 119 | antigen bundle git 120 | antigen bundle heroku 121 | antigen bundle pip 122 | antigen bundle lein 123 | antigen bundle command-not-found 124 | 125 | # Syntax highlighting bundle. 126 | antigen bundle zsh-users/zsh-syntax-highlighting 127 | 128 | # Auto suggestion bundle. 129 | antigen bundle zsh-users/zsh-autosuggestions 130 | 131 | # Load the theme. 132 | antigen theme https://github.com/caiogondim/bullet-train-oh-my-zsh-theme bullet-train 133 | 134 | # User installed plugins. 135 | antigen bundle tmux 136 | antigen bundle kubectl 137 | 138 | # Tell antigen that you're done. 139 | antigen apply 140 | 141 | # Bullet Train theme config 142 | BULLETTRAIN_PROMPT_ORDER=( 143 | time 144 | context 145 | dir 146 | git 147 | ) 148 | 149 | export VIRTUAL_ENV_DISABLE_PROMPT= 150 | 151 | # nvm 152 | export NVM_DIR="$HOME/.nvm" 153 | . "$(brew --prefix nvm)/nvm.sh" 154 | 155 | # pyenv 156 | export PYENV_ROOT="$HOME/.pyenv" 157 | export PATH="$PYENV_ROOT/bin:$PATH" 158 | eval "$(pyenv init -)" 159 | 160 | # gvm 161 | [[ -s "/home/$USER/.gvm/scripts/gvm" ]] && source "/home/$USER/.gvm/scripts/gvm" 162 | 163 | # php composer 164 | export COMPOSER_BIN="$(composer config -g home)/vendor/bin" 165 | export PATH="$COMPOSER_BIN:$PATH" 166 | 167 | # direnv 168 | eval "$(direnv hook zsh)" 169 | 170 | # z 171 | . /home/linuxbrew/.linuxbrew/etc/profile.d/z.sh 172 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | tap "ethereum/ethereum" 2 | tap "go-delve/delve" 3 | tap "homebrew/bundle" 4 | tap "homebrew/core" 5 | tap "ktr0731/evans" 6 | tap "linuxbrew/extra" 7 | tap "linuxbrew/xorg" 8 | brew "amazon-ecs-cli" 9 | brew "antigen" 10 | brew "bzip2" 11 | brew "libffi" 12 | brew "readline" 13 | brew "zlib" 14 | brew "sqlite" 15 | brew "xz" 16 | brew "libxml2" 17 | brew "awscli" 18 | brew "composer" 19 | brew "direnv" 20 | brew "docker-compose" 21 | brew "fzf" 22 | brew "gcc" 23 | brew "git-flow-avh" 24 | brew "helm" 25 | brew "jq" 26 | brew "kubernetes-cli" 27 | brew "kops" 28 | brew "libxmlsec1" 29 | brew "minikube" 30 | brew "neovim" 31 | brew "nvm" 32 | brew "protobuf" 33 | brew "pyenv" 34 | brew "rbenv" 35 | brew "tmux" 36 | brew "tor" 37 | brew "tree" 38 | brew "z" 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # My Journey on Configuring Windows 10 for Web Dev 2 | 3 | This is my journal about configuring Windows 10 to become my primary machine for web development. Not all of these steps necessary, you can choose whatever step that suits your need. 4 | 5 | SideNote: 6 | 7 | - i'm using Windows 10 Pro 64bit 8 | - i'm using Ubuntu 20.04 as default WSL distro 9 | 10 | ### Contents 11 | - How-Tos 12 | - [Install and Configure Colemak as My Default Keyboard Layout](#install-and-configure-colemak-as-my-default-keyboard-layout) 13 | - [Change Machine Name](#change-machine-name) 14 | - [Turn on Disk Encryption (Windows 10 Pro only)](#turn-on-disk-encryption-windows-10-pro-only) 15 | - [Enable Built in Clipboard](#enable-built-in-clipboard) 16 | - [Enable Night Light](#enable-night-light) 17 | - [Change to Small Taskbar](#change-to-small-taskbar) 18 | - [Enable Fingerprint](#enable-fingerprint) 19 | - [Enable WSL and Upgrade to WSL 2](#enable-wsl-and-upgrade-to-wsl-2) 20 | - [Install Chocolatey (Package Manager for Windows)](#install-chocolatey-package-manager-for-windows) 21 | - [Install and Configure Terminal for Windows from Microsoft Store](#install-and-configure-terminal-for-windows-from-microsoft-store) 22 | - [Install Ubuntu Tools and Utility in WSL](#install-ubuntu-tools-and-utility-in-wsl) 23 | - [Make WSL Terminal Pretty and Powerful](#make--wsl-terminal-pretty-and-powerful) 24 | - [Sharing SSH between Windows and WSL and Configure Correct Permission for SSH in WSL](#sharing-ssh-between-windows-and-wsl-and-configure-correct-permission-for-ssh-in-wsl) 25 | - [Fix Folder and Files Default Permission in Windows (From WSL Perspective)](#fix-folder-and-files-default-permission-in-windows-from-wsl-perspective) 26 | - [Install and Configure Git](#install-and-configure-git) 27 | - [Sharing Git Credentials Between Windows and WSL](#sharing-git-credentials-between-windows-and-wsl) 28 | - [Install and Configured Docker for Windows](#install-and-configured-docker-for-windows) 29 | - [Install and Configure VSCode + Remote Development Pack](#install-and-configure-vscode--remote-development-pack) 30 | - [Restart WSL from Task Manager](#restart-wsl-from-task-manager) 31 | - [Install OpenSSH Server and Client](#install-openssh-server-and-client) 32 | - Known Bugs 33 | - [WSL 2 Consumes Too Much CPU / Memory](#wsl-2-consumes-too-much-cpu--memory) 34 | 35 | ## How-Tos 36 | 37 | ### Install and Configure Colemak as My Default Keyboard Layout 38 | 39 | I'm using colemak as my keyboard layout for more than 5 years now. Unfortunately, Windows not shipped with colemak out of the box so i need to install it myself (c'mon guys, colemak even included by default in linux). 40 | 41 | - Colemak for Windows have 2 version, one with Capslock mapped to Backspace and one that doesn't. I'm using the former. You can download both version [here](https://colemak.com/Windows). For the one i use, download it from [here](https://forum.colemak.com/topic/1621-colemak-for-windows-with-capslock-to-backspace/). 42 | - Go to Settings > Time & Language > Preferred Language and Choose the primary language. Mine is English (US). Then click Options button. Make sure that Colemak already registered there. 43 | - To make Colemak as primary keyboard layout, Go to Settings and type `Advanced Keyboard Settings` and choose Colemak from the dropdown. 44 | - To disable (annoying) Ctrl + Shift combo that change the keyboard layout accidentally, still in `Advanced Keyboard Settings`, go to `Input language hot keys` choose `Between input languages` then press `Change Key Sequence` button. Choose `Not Assigned` options for both of settings. 45 | 46 | ### Change Machine Name 47 | 48 | - Go to Settings > System > About > Rename this PC 49 | 50 | ### Turn on Disk Encryption (Windows 10 Pro only) 51 | 52 | Since i have many confidential files, i need to encrypt my harddisk. We can use Bitlocker which is come with Windows 10 Pro by default. 53 | 54 | - Open explorer (Win + E) 55 | - Right click on C:\ (i only have single partition for everything), then choose Turn on Bitlocker 56 | 57 | ### Enable Built in Clipboard 58 | 59 | - Go to Settings > System > Clipboard > Clipboard History > On 60 | - Access clipboard using Win + V 61 | 62 | ### Enable Night Light 63 | 64 | - Go to Settings > System > Display > Night light > On 65 | 66 | ### Enable Dark Mode 67 | 68 | - Go to Settings > Personalization > Colors > Choose your color > Dark 69 | 70 | ### Change to Small Taskbar 71 | 72 | - Go to Settings > Personalization > Taskbar > Use small taskbar buttons > On 73 | 74 | ### Enable Fingerprint 75 | 76 | If your machine support Windows Hello, you can setup fingerprint mode for login which very convenient IMO. 77 | 78 | - Setup your account with password first 79 | - Go to Settings > Account > Sign in options > Windows Hello Fingerprint 80 | 81 | ### Enable WSL and Upgrade to WSL 2 82 | 83 | - To enable WSL, go to Settings > Apps > Program and Features (on the top right side) > Turn off Windows features on or off > Check Hyper-V, Virtual Machine Platform, and Windows Subsystem for Linux 84 | 85 | - Follow instruction in this [page](https://docs.microsoft.com/en-us/windows/wsl/install-win10) to upgrade to WSL 2. Your Windows version must be in version 2004 to use WSL 2. 86 | 87 | - Included in that page, there are steps for Ubuntu 20.04 installation from Microsoft Store after done installing WSL 2. We also will set WSL 2 as default WSL (since we have WSL 1 and WSL 2). 88 | 89 | - Set default distro to Ubuntu 20.04 by using 90 | 91 | ``` 92 | wsl -s , wsl --setdefault 93 | ``` 94 | 95 | ### Install Chocolatey (Package Manager for Windows) 96 | 97 | - Follow this instruction from [Chocolatey install guide](https://chocolatey.org/install) 98 | 99 | ### Install and Configure Terminal for Windows from Microsoft Store 100 | 101 | - Install `Terminal` from Microsoft Store 102 | 103 | - Make Ubuntu 20.04 as default by setting the value of `defaultProfile` to Ubuntu guid. You can find it under list, still in settings.json file 104 | 105 | - Change starting directory to linux home directory instead of /mnt/c/User by adding this properties under Ubuntu 20.04 profile 106 | 107 | ```json 108 | "startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\home\\[linux-username]" 109 | ``` 110 | 111 | - We can also reorder the list and move Ubuntu 20.04 to the top so by default Terminal app will choose Ubuntu when we click `+` button. 112 | 113 | ### Install Ubuntu Tools and Utility in WSL 114 | 115 | ``` 116 | sudo apt install curl git net-tools xsel acpi htop 117 | ``` 118 | 119 | ### Make WSL Terminal Pretty and Powerful 120 | 121 | I already use several tools not only to make my terminal more powerful, but also pleasing to the eye. The tools are: 122 | 123 | - Homebrew. Homebrew, which is known as package manager in MacOS, also available in linux. Homebrew provide many ready to use scripts and tools so we don't need to built from source manually. To install, follow instruction [here](https://brew.sh/). To backup and restore, you can use `brew bundle dump` for backup and `brew bundle` to restore. More on those, you can read it [here](https://tomlankhorst.nl/brew-bundle-restore-backup/) 124 | 125 | - ZSH + Oh-My-ZSH + antigen 126 | 127 | - Tmux 128 | 129 | - Powerline fonts. We can install the font in Windows automatically without having to install them one by one using font viewer. 130 | 131 | - Clone the font from https://github.com/powerline/powerline.git in directory that you have chosen. 132 | 133 | - Open Powershell, then run `Get-ExecutionPolicy`. If it returns `Restricted`, then run 134 | 135 | ``` 136 | Set-ExecutionPolicy Bypass -Scope Process 137 | ``` 138 | 139 | - Change directory to where powerline cloned (get inside the folder called `fonts-master`), and run `install.ps1` 140 | 141 | - Change font in Terminal to powerline font by adding this line to Ubuntu profile in settings.json 142 | 143 | ``` 144 | "fontFace": "DejaVu Sans Mono for Powerline" 145 | ``` 146 | 147 | - To open wsl directory on windows explorer, simply open wsl and run `explorer.exe .`. If you come previously from ubuntu, you can copy your configuration file here (.zshrc, .tmux.conf, .gitconfig, ssh folder etc) 148 | 149 | My WSL console appearance: 150 | 151 | ![My WSL Console](https://i.imgur.com/KP03Ww9.png) 152 | 153 | ### Sharing SSH between Windows and WSL and Configure Correct Permission for SSH in WSL 154 | 155 | - Follow instruction [here](https://devblogs.microsoft.com/commandline/sharing-ssh-keys-between-windows-and-wsl-2/) 156 | 157 | - Don't forget to set the permission (chmod) of the SSH folder and files so we can use it normally. 158 | 159 | .ssh directory: 700 (drwx------) 160 | public key (.pub file) & known host: 644 (-rw-r--r--) 161 | private key (id_rsa): 600 (-rw-------) 162 | lastly your home directory should not be writeable by the group or others (at most 755 (drwxr-xr-x)). 163 | 164 | ### Fix Folder and Files Default Permission in Windows (From WSL Perspective) 165 | 166 | Windows by default assign 777 if the file is located outside WSL. We can fix this by 167 | 168 | - adding this setting in `.profile` inside WSL home directory 169 | ``` 170 | if [[ "$(umask)" = "0000" ]]; then 171 | umask 0022 172 | fi 173 | ``` 174 | 175 | - create file (if not exists) `/etc/wsl.conf` and put this inside the file content 176 | ``` 177 | [automount] 178 | enabled=true 179 | options=metadata,uid=1000,gid=1000,umask=022 180 | ``` 181 | 182 | ### Install and Configure Git 183 | 184 | Git can be a pain for a cross platform project. This is due to difference in how line ending being treated in Windows and *nix OS. Windows using CRLF, *nix using LF 185 | 186 | - Install git in WSL with `sudo apt install git` if you haven't done this before. This git limited to WSL console only. If you want to use git in your IDE, you must install Git for Windows 187 | 188 | - If you see all your existing project suddenly become modified, don't panic. Resolve it by using this setting in your global git config 189 | 190 | ``` 191 | git config --global core.autocrlf true 192 | git config --global core.filemode false 193 | ``` 194 | 195 | Basically, `core.autocrlf true` will use this conversion rule `Checkout -> CRLF, Commit -> LF`. This is suitable for windows, since any project from remote repo's line ending will automatically converted to CRLF in checkout. On commit, it will be automatically converted to LF. Meanwhile `core.filemode false` will ignore the difference in permission between folder/file checked out in WSL or Windows storage. 196 | 197 | Still see the files modified in git status ? check your entire config by using `git config --list --show-origin` to make sure that the global config is not overridden by project-scoped config. 198 | 199 | By the way, **if you have project that meant to be run in Linux, put them inside WSL folder**. If you put the project outside WSL, the access will be significantly slow and some watch feature (create react app hot reload, webpack watch) will not work. More on that, see the comment about WSL 2 limitation [here](https://github.com/microsoft/WSL/issues/4739#issuecomment-582374769) 200 | 201 | ### Sharing Git Credentials Between Windows and WSL 202 | 203 | - Follow instructions [here](https://code.visualstudio.com/docs/remote/troubleshooting#_sharing-git-credentials-between-windows-and-wsl) 204 | 205 | ### Install and Configured Docker for Windows 206 | 207 | - Download the exe [here](https://docs.docker.com/docker-for-windows/install/) 208 | - If WSL 2 is installed, Docker will ask to use WSL 2 by default. 209 | - After installation finished, go to docker icon in taskbar, then choose Settings > Resources > WSL Integration > turn on Ubuntu 20.04 210 | - Check the integration by opening WSL console, then type `docker version`. It should return with installed docker information. 211 | 212 | ### Install and Configure VSCode + Remote Development Pack 213 | 214 | - Install VSCode, then download Remote Development extension from Microsoft 215 | 216 | - To set default terminal in VSCode to WSL, put this in VSCode settings.json 217 | 218 | ``` 219 | "terminal.integrated.shell.windows": "C:\\Windows\\System32\\wsl.exe" 220 | ``` 221 | 222 | - To open your project using VSCode in WSL context, the easy way is just open WSL console, go to your project root, then type `code .` and VSCode will be open and automatically connected with WSL. 223 | 224 | - See [here](https://code.visualstudio.com/docs/remote/wsl) for more complete instruction on setting VSCode and WSL 225 | 226 | ### Restart WSL from Task Manager 227 | 228 | Sometimes, the connection to the WSL is lost / freeze. We can restart it by go to Task Manager > Services > LxssManager then right click and choose Restart. 229 | 230 | ### Install OpenSSH Server and Client 231 | 232 | To make ssh command accessible from Powershell, we can install OpenSSH via Settings > Apps > Apps & features > Optional features > Add a feature > type "OpenSSH" 233 | 234 | ## Known Bugs 235 | 236 | ### WSL 2 Consumes Too Much CPU / Memory 237 | 238 | Open the Task Manager and see if `Vmmem` is causing your CPU / memory usage to 100%. Don't worry, that's not because your machine is lack of memory. In the following [github issue](https://github.com/microsoft/WSL/issues/4166), someone reported that his machine (which having 64GB RAM) also encountered this problem too. Basically, it's a known bug when we use WSL 2. This is the workaround: 239 | 240 | - Create a file under C:\Users\your-username called .wslconfig and put this inside the file. Basically it is for limiting how much memory that wsl2 consumes. We can change the configuration as we see fit. 241 | 242 | ``` 243 | [wsl2] 244 | memory=4GB 245 | swap=16GB 246 | localhostForwarding=true 247 | ``` 248 | 249 | Another workaround is to empty the cache in linux so it will free the memory and return it to windows 250 | 251 | - create an alias called drop_cache 252 | 253 | ``` 254 | alias drop_cache="sudo sh -c \"/usr/bin/echo 3 > /proc/sys/vm/drop_caches\" && printf '%s\n' 'Ram-cache Cleared'" 255 | ``` 256 | 257 | and run this everytime the `Vmmem` start eating up your RAM. --------------------------------------------------------------------------------