Installing Windows Subsystem for Linux (WSL) on NOAA Computers

Windows Subsystem for Linux (WSL) allows developers to run a Linux environment on Windows computers without having to use a dual-boot setup. There are several blog posts that outline how to install WSL2 (e.g., instructions from Microsoft) but, if you are working on a NOAA-issued computer, the installation requires some assistance from your IT department. And, even though WSL2 and Docker Engine are on the Office of Science and Technology’s approved software list not many people ask IT to install it. So your local IT might not know all the tips and tricks for a seamless process, which is why we wrote this blog post. We hope that having these instructions will help limit installation barriers and encourage NOAA employees to explore using WSL2.

Why WSL

First, why would you even want to experiment with WSL? First, there are several Linux-specific tools, bash scripts, and Docker containers that just work better or only work on Linux. And, running a dual-boot system, i.e., having both Linux and Windows on the same machine, can be a headache and lead to less overall available disk space. Specifically, for the Fisheries Integrated Modeling System (FIMS), we use WSL to facilitate debugging C++ code using gdb. In theory, you can use gdb on Windows but it does not integrate well with compiled code because the -d flag is a Unix-only feature in R.

Second, we found a huge cost saving by installing WSL because we were able to limit our use of codespaces (which is a Linux environment) once we were able to mimic the process on our own computer. Not only is WSL helpful for using gdb but it is also helpful for debugging failed GitHub workflows that are often running on Linux environments. As we are pushed to do more and more in the cloud, learning how to navigate Linux systems using WSL will pay off more and more.

Third, many projects provide a devcontainer.json file in the .devcontainer directory that facilitates launching a fully configured environment inside of VS Code without needing to manually install project dependencies, compilers, or other system tools on your local machine. In fact, these configuration files are becoming more prevalent as the use of GitHub codespaces increases and as more people use {renv} for package management.

Install WSL2 and Docker Engine

Steps:

  1. Contact IT to install WSL2 and Docker Engine on your Windows machine
  2. For detailed technical information, refer to:
  3. Important: Have IT “Turn Windows features on or off” for WSL on Windows in addition to installing the software. Here are similar instructions to guide them through this step.

Install VS Code and Extensions

Once WSL is installed, you’ll need to set up Visual Studio Code to work with your new Linux environment.

  1. Open Visual Studio Code
  2. Open the Extensions view with Ctrl + Shift + X
  3. Install the following extensions:
    • WSL extension (ID: ms-vscode-remote.remote-wsl) — allows VS Code to connect to the WSL environment
    • Dev Containers extension (ID: ms-vscode-remote.remote-containers) — builds and manages development containers from the .devcontainers/devcontainer.json file

Install a Distribution

The final step is to set up a distribution of Linux as your WSL distribution. We chose to highlight the installation of Ubuntu, but you can install any distribution that you like. To see all of the distributions that are available run wsl --list --online once WSL is installed and in your path. I personally like Debian because it is a bit lighter weight and more conservative on their update rates than Ubuntu.

  1. Open a Windows Command Prompt and check if Ubuntu is already listed as a WSL distribution:
wsl --list --verbose

NAME      STATE           VERSION
* Ubuntu    Stopped         2
  1. If Ubuntu is not listed under the NAME column, run the following command to install it:
wsl --install -d Ubuntu

Using WSL

There are many posts about using WSL on the Internet, e.g., Microsoft’s Get started using VS Code with WSL. Additionally, there are instructions in the FIMS repository on how to use WSL with FIMS.

Best of luck. And, feel free to reach out to the FIMS developers if you have questions.