Install Linux on Windows with Windows Subsystem for Linux, WSL

, , ,

The Windows Subsystem for Linux lets developers run a GNU/Linux environment — including most command-line tools, utilities, and applications — directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.

 

With Windows Subsystem for Linux you can:

  • Choose your favorite GNU/Linux distributions from the Microsoft Store.
  • Run common command-line tools such as grep, sed, awk, or other ELF-64 binaries.
  • Run Bash shell scripts and GNU/Linux command-line applications including:
    • Tools: vim, emacs, tmux
    • Languages: NodeJS, Javascript, Python, Ruby, C/C++, C# & F#, Rust, Go, etc.
    • Services: SSHD, MySQL, Apache, lighttpd, MongoDB, PostgreSQL.
  • Install additional software using your own GNU/Linux distribution package manager.
  • Invoke Windows applications using a Unix-like command-line shell.
  • Invoke GNU/Linux applications on Windows.

As of Feb. 24th, 2022 the instructions for setting up the Windows Subsystem for Linux has gotten even easier and much faster.

Read how to install WSL right from Microsoft’s own website. Then read how to set up your WFL development environment.

 

Install WSL

Install everything you need to run Windows Subsystem for Linux (WSL) by entering the following command in an administrator PowerShell or Windows Command Prompt and then restart your PC: wsl –install

 

Install Windows Subsystem for Linux WSL on Windows 10

 

This command will enable the required optional components, download the latest Linux kernel, set WSL 2 as your default, and install a Linux distribution for you (Ubuntu by default, see below to change this). The first time you launch a newly installed Linux distribution, a console window will open and you’ll be asked to wait for files to de-compress and be stored on your machine. All future launches should take less than a second.

Note

The above command only works if WSL is not installed, if you run wsl –install and see the WSL help text, please try running wsl –list –online to see a list of available distros and run wsl –install -d <DistroName> to install a distro.

 

Change the default Linux distribution installed

By default, the installed Linux distribution will be Ubuntu. This can be changed using the -d flag.

  • To change the distribution installed, enter: wsl –install -d <Distribution Name>. Replace <Distribution Name> with the name of the distribution you would like to install.
  • To see a list of available Linux distributions available for download through the online store, enter: wsl –list –online or wsl -l -o
  • To install additional Linux distributions after the initial install, you may also use the command: wsl –install -d <Distribution Name>

Tip

If you want to install additional distributions from inside a Linux/Bash command line (rather than from PowerShell or Command Prompt), you must use .exe in the command: wsl.exe –install -d <Distribution Name> or to list available distributions: wsl.exe -l -o

If you run into an issue during the installation process, check the installation section of the troubleshooting guide.

 

Conclusion

As always, I welcome your thoughts, questions or suggestions on my article, in this case a link to, installing Linux on Windows 10 using Windows Subsystem for Linux (WSL).

You may support my work by sending me a tip using your Brave browser or by sending me a one time donation using your credit card.

Let me know if you found any errors within my article or if I may further assist you by answering any additional questions you may have.