Feb 2, 2021 attempt to quickly bootstrap a linux environment for use with windows WSL2
- Follow the instructions for installing WSL2
- Install Windows Terminal and Ubuntu 20.04 from the windows store
- Load up an Ubuntu window in the windows Terminal
- Go and make the Network speed improvment:](microsoft/WSL#4901):
- Windows search for "View network connections"
- Find the vEthernet (WSL) one and click properties then the configure button
- Advanced tab: disable "Large Send Offload Version 2" for both ipv4 and ipv6
- Now , in the Windows Terminal Ubuntu Run this:
sh -c "$(wget https://raw.githubusercontent.com/MattReimer/environment/master/bootstrap.sh -O -)"
It will take a while and there will be prompts. When you drop into the oh-my-zsh prompt and it hangs type 'exit' and press enter to finish the install
- copy your ssh keys and other config from appropriate places
cp -fr /mnt/c/Users/MyName/.ssh ~/.ssh
# your id_rsa files need stronger permissions
chmod 600 ~/.ssh/id_rsa*
# then any other config files you may need
cp -fr /mnt/c/path/to/.aws ~/.aws
cp -fr /mnt/c/path/to/.riverscapes ~/.riverscapes
- Make sure you have the Remote-WSL extension installed.
- Look for the little green menubar icon in the bottom left of the window.
- Connect to a New Remote-WSL: New Window Using Distro.
- You may have to choose zsh as your default terminal
- In
Docker --> Settings --> Resources --> WSL Integrations
Check the box to allow Docker access from inside your WSL integration
NB: All wsl commands should be run in powershell
- See what versions of WSL I have running?
wsl --list --verbose
- Shutdown all my WSL2
wsl --shutdown
- Delete my WSL and start over? WARNING!!! Unrecoverable!!!!
wsl --unregister Ubuntu-20.04
Now when you click on the ubuntu item in your start menu it will give you a new install
- Limit the RAM my WSL uses
Create a file in your windows user root C:\Users\MYACCT\.wslconfig
and paste in the following (this also enables a swap space. DO NOT PUT THE SWAP ON AN SSD. Just ignore that line if you don't want a swap):
[wsl2]
memory=6GB
swalFile=E:\\wsl2-swal.vhdx
- I deleted files in WSL but my C:\ doesn't show any change:
This one's a bit tricky because the folder to look in shifts around. You need to match the pattern below
# this is the folder that contains the VM file. You will need to search for it a little
cd $env:LOCALAPPDATA\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState
wsl --shutdown
optimize-vhd -Path .\ext4.vhdx -Mode full