Table Of Contents
- WSL
- Pre-requisites
- Install Linux Distribution
- Upgrade Distro
- Launch Distro
- Re-install Distro
- Change Mount Path
- Install Docker
- Install Git, Node & Python
- References
WSL
WSL was introduced with Windows 10 Fall Creators Update and later (Windows build 16215 or later).
Pre-requisites
Ensure that “Windows Subsystem for Linux” feature is enabled by running below command in PowerShell
as an administrator.
You can also enable it via Turn Windows features on or off
control panel option by checking Windows Subsystem for Linux
.
Install Linux Distribution
- Open the Microsoft Store and choose your favorite Linux distribution.
- From the distro’s page, select “Get” to install the distribution.
You might get below error if incase your corporate policies prevent install from Microsoft store.
In that case, download the distros and manually install them.
Running the .appx file will still fail due to the corporate policy. To overcome the issue follow below steps:
- Rename the extension of the .appx file to .zip.
- Extract all the contents.
- Run the .exe file inside the extracted folder.
Once the installation is complete, you will be asked to create a new user account with password.
When you launch your distro, you won’t be asked for a password unless you elevate your access using sudo
.
Upgrade Distro
Windows does not automatically update or upgrade your Linux distro(s). On Debian/Ubuntu, you can use apt to upgrade the packages:
Launch Distro
You can launch the distribution in multiple ways:
- Launch from windows store
- Running wsl command from command prompt
wsl [command]
- Running wsl.exe which allows you to manage your distributions, set default distribution and uninstalling distributions.
Re-install Distro
You will get an error 0x80070003
if you manually delete the ubuntu folder and start WSL. It occurs when the path where you had installed your distro is not present/deleted/removed. E.g. when you move your distro folder to your C: drive.
In that case, you will have to unregister the distro and re-install it.
List the distros available to WSL:
Unregister the distro with the distribution name:
Re-install the distro again.
Change Mount Path
WSL mounts your machine’s fixed drives under the /mnt/<drive>
folder in your Linux distros.
To change the mount path to /
so that you don’t have to change directory to your drive everytime you run wsl, create a wsl.conf
file.
Paste below contents and save it. On your next restart, the changes should get reflected.
Install Docker
To install docker and docker compose in WSL run below script:
Enable Expose daemon on tcp://localhost:2375 without TLS
in your Docker for Windows
settings.
We then configure WSL to connect to the remote docker daemon running in Docker for Windows
.
We then run docker commands in WSL.
Install Git, Node & Python