Windows Setup
Installation Prerequisites
Linux on Windows with WSL
Ubuntu v20.04-LTS (download and install from Microsoft store app)
Windows Terminal (download from Microsoft store app)
Docker Desktop
Install Desktop Docker with WSL2 backend
VS Code (Remote-wsl and python extensions are helpful)
Install VS Code for your Windows version: https://code.visualstudio.com/
Then from within the Extensions install the following extensions:
Setup Instructions
Run (or Setup for first time) Ubuntu in Windows.
Note
Windows may not be ready to install a Linux environment & will inform you to activate Windows Subsystem for Linux first. If you get such an error, see (https://docs.microsoft.com/en-us/windows/wsl/install) for additional details (and follow these instructions):
Press Win+R
Type: cmd.exe
To gain elevated admin privileges, press: Ctrl+Shift+Enter
At the command line, type:
cd C:\WINDOWS\system32
Then:
wsl --install -d Ubuntu-20.04
Next follow the prompts to install the actual Ubuntu system.
Launch Ubuntu and set your username and password
Close Ubuntu window
Launch windows terminal:
In the Windows Terminal settings:
In “Startup” settings: Set the Default System to “ubuntu 20.04” (and save changes)
Under “Profiles”, change the starting directory for “Ubuntu 20.04” to:
\\wsl$\Ubuntu-20.04\home\<username>
Note
Replace “<username>” with the username you created during the Ubuntu Install.
Update/install the following packages in your windows terminal linked to Ubuntu
sudo apt update -y && sudo apt upgrade -y sudo apt install -y python3-pip python3-venv nano
After Ubuntu is set up, add a WSL configuration file in the
/etc
folder of your Ubuntu instance so it mounts the drive with metadata and the SSH works (do these with windows terminal)
sudo nano /etc/wsl.conf # Type in this and save the file: [automount] options = "metadata"
Add a WSL configuration file in the Windows user directory (change to your username), to limit memory usage (by default WSL will consume 50% or 8GB of memory or whichever amount is smaller)
Add Global memory limits for the Windows Environment via Powershell to your Windows home directory (e.g.
C:\Users\<username>\.wslconfig
):
sudo nano /mnt/c/Users/<user>/.wslconfig # Type in this and save the file: [wsl2] processors=2 # Limits WSL2 VM use to two virtual processors memory=6GB # Limits WSL2 VM memory to 6GB - Capability to add memory limits on the installed distribution (Ubuntu) Environment anre not necessary to perform, but is referenced here for awareness: - Access the ``/etc`` directory by entering:
cd /etc # Verify you have a wsl.conf file in the /etc/ directory contents & then edit: ls -la | grep wsl.conf nano wsl.conf
Note
To see which options you can place into the configuration file, view this article: - https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig
Run Docker Desktop, enable integration with WSL2 Ubuntu & link your docker to Bitbucket.
In Docker Desktop you will need to add the Ubuntu distribution to your WSL2 settings for WSL integration:
Go into “Resources” and select sub-menu “WSL Integration”: Enable integration with additional distros…
Turn on switch for: “Ubuntu-20.04” (first make sure “Enable integration with my default WSL distro is checked”)
- If ‘Ubuntu-20.04’ switch is not present, trouble shoot using the following:
In Powershell, type in the following command to check which version of Ubuntu you are running:
wsl --list –verbose # Version should be 2 for all names. NAME STATE VERSION Ubuntu-20.04 Running 2 docker-desktop Running 2 docker-desktop-data Running 2 # If Ubuntu-18.04 is in Version 1, enter the following command: wsl --set-default-version 2 # Check again which version of Ubuntu you are running.
If you are running version 2, Refresh Docker Desktop and the Ubuntu-20.04 switch should be visible.