Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
It can also be done from Settings > Updates & Security. Google it.
For WSL2 there's another command. Google it.
user: username
pass: *********
Here are some examples:
- DotENV
- Docker
- vscode-icons
- Diff
- Git Blame
- Git History
- KillTasksButton
- npm
- TSLint
- Visual Studio IntelliCode
- vscode-styled-components
4. Fix WSL new folders permissions (https://www.turek.dev/post/fix-wsl-file-permissions/):
-
Create
wsl.confin/etc/if it doesn't exists. Else, modify to contain this part (For uid and gid check:cat /etc/passwd):user@host:~$ touch /etc/wsl.conf[automount] enabled = true root = / options = "metadata,uid=1000,gid=1000,dmask=0022,umask=0022,fmask=0011" -
Add to
~/.profile(at the end)user@host:~$ nano ~/.profile# Note: Bash on Windows does not currently apply umask properly. if [[ "$(umask)" = "0000" ]]; then umask 0022 fi
Other wsl config resources:
https://docs.microsoft.com/en-us/windows/wsl/wsl-config
https://devblogs.microsoft.com/commandline/automatically-configuring-wsl/
Keep all of your project files and development work in a linked C drive directory. If you do that, even if you have to reinstall the WSL, you won’t lose any work!
6. Restart WSL (by restarting the computer or the wsl service: https://superuser.com/questions/1319478/rebooting-wsl-in-windows-1803)
Now, C:\ drive is mounted in /c/ instead of /mnt/c/ which is better for Docker
user@host:~$ sudo apt update
user@host:~$ sudo apt upgrade
user@host:~$ code .
This will install VSCode Server:
Installing VS Code Server for x64 (5763d909d5f12fe19f215cbfdd29a91c0fa9208a)
Downloading: 100%
Unpacking: 100%
Unpacked 2321 files and folders to /home/user/.vscode-server/bin/5763d909d5f12fe19f215cbfdd29a91c0fa9208a.
Check extensions in VSCode: Some must be installed also in WSL. They appear with Install in WSL: Ubuntu-20.04
user@host:~$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
user@host:~$ nvm ls-remote
user@host:~$ nvm install --lts=dubnium
user@host:~$ ln -s /c/Users/<user>/.ssh ~
IF you get this error when trying to clone for example user@host:/c/workspace$ git clone git@domain.com:path/to/repository.git repo-name:
Cloning into 'repo-name'...
Warning: Permanently added the ECDSA host key for IP address '**.***.**.***' to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0744 for '/home/user/.ssh/id_rsa' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/home/user/.ssh/id_rsa": bad permissions
git@domain.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
then:
user@host:~$ cd ~/.ssh
user@host:~/.ssh$ chmod 600 *
user@host:~$ ln -s /c/Users/<user>/.gitconfig ~
[user]
email = user.email@domain.com
name = User Name
[alias]
up = "!git remote update -p; git merge --ff-only @{u}"
upall = "!git branch|cut -c2-|while read B; do git branch --set-upstream-to=\"origin/${B}\" \"${B}\" && git checkout \"$B\" && git up; done"
https://stackoverflow.com/questions/36724209/disable-beep-of-linux-bash-on-windows-10
-
Uncomment
set bell-style noneandset bell-style visiblein/etc/inputrcuser@host:~$ sudo nano /etc/inputrc -
Add this line to
~/.vimrc(create~/.vimrcif not exists)set visualbell -
To disable the beep also in less (i.e. also in man pages and when using "git diff") you need to add
export LESS="$LESS -R -Q"in your~/.profilefile. -
Add to
~/.bashrc(at the end)user@host:~$ nano ~/.bashrc# Disable annoying bell sound in terminal setterm blength 0
1. VSCode opened from inside a symbolic link (symlink) will encounter problems with git real time refresh
microsoft/vscode-remote-release#314
Therefore, creating a symlink for /c/workspace inside the home folder is NOT recomended (like this user@host:~$ ln -s /c/workspace ~)
https://superuser.com/questions/1319478/rebooting-wsl-in-windows-1803