Setting Up WSL On Windows

File tray

What is WSL?

Windows Subsystem for Linux (WSL) is a way to install Linux on your Windows computer without having to deal with the overhead and configuration of a Virtual Machine. This allows you to use Linux applications, utilities, and Bash directly from the Windows command line.

This is a great utility to have if you are using Windows for work but still have to interact with Linux workstations/servers. I use mainly use WSL for Docker, SSHing into the few Linux servers I maintain at work, or when I am wanting to use Linux utilities such as grep/egrep.

Steps To Install WSL

  1. First, you will need to open up the Command Prompt as Administrator.
  2. Enter the command wsl --install
    • This command will enable WSL and install the Ubuntu Linux distribution.

You now have Ubuntu installed and accessible through the Windows Command Line. The command above does make Ubuntu your default distro. What if you don’t want to use Ubuntu?

Installing a New Distro

Lets just start by listing out all of the Linux distributions that are available to download by typing wsl --list --online.

Shows the list of distros available for download

For this demo I will be installing Debian. You can replace Debian in the commands to install any of the distros listed in the image. To install the distro, type wsl --install "Debian". This will install and launch Debian in the current command window. On launch, you will be asked to enter a new UNIX username and password.

Shows the installing of the Debian distro

Changing the Default

You now have two Linux distributions installed but Ubuntu is still the default. To start, we will just list out the distributions that we have installed on the machine with wsl --list.

Lists the distros installed on the computer

Lets make Debian our default now. Simply type wsl --setdefault "Debian" into the command prompt and the default is now Debian!

Conclusion

Windows Subsystem for Linux (WSL) is a really nice tool that helps give the functionality and tooling that Linux offers in a Windows environment.

If there is more about this subject, or another subject you want me to address, please leave a comment and let me know.