Skip to main content

Windows Setup

Installation Prerequisites

  1. Linux on Windows with WSL

  2. Ubuntu v20.04-LTS (download and install from Microsoft store app)

  3. Windows Terminal (download from Microsoft store app)

  • Docker Desktop

  • VS Code (Remote-wsl and python extensions are helpful)

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

  1. Next follow the prompts to install the actual Ubuntu system.

  2. Launch Ubuntu and set your username and password

    • Close Ubuntu window

  3. 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.