Windows Subsystem for Linux (WSL) is a Microsoft Windows feature that enables you to run Linux natively on Windows without needing a virtual machine or dual booting. It provides developers with a seamless Linux environment with command line tools, utilities, and applications directly within Windows, improving workflow efficiency and interoperability between operating systems.
See the WSL documentation for more detailed instructions on getting started with WSL. |
Set up your workstation
Requirements
-
A 64-bit Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.
-
Virtualization must be enabled in your system’s BIOS or UEFI settings.
-
8 GB of RAM.
-
8 CPU cores.
-
250 GB of free disk space. SSDs are highly recommended for system development build times.
.1. Enable WSL on Windows
If you are using Docker, make sure you have installed Windows Subsystem for Linux v2 (WSL 2) before running Docker Desktop. |
-
Press Win+S and type
PowerShell
. -
Right-click on Windows PowerShell, and select Run as Administrator.
-
Type the following command to install the default Linux distribution (Ubuntu).
$ wsl --install
If you already have WSL installed but need to upgrade, run:
$ wsl --upgrade
-
Restart your computer after the installation completes to apply the changes.
.2. Set Up Ubuntu on WSL
-
After your system restarts, open the Ubuntu app from the Start menu. This initializes the Ubuntu installation.
-
Create a user account. You will be prompted to create a Linux username and password. These credentials are specific to the Ubuntu environment.
-
Once the installation completes, update the package manager to ensure all packages are up to date:
$ sudo apt update && sudo apt upgrade -y
Configure WSL for system development
To use this machine for system development, follow the steps in Set up native Linux PC.
By default, WSL 2 dynamically allocates memory and can grow its memory usage up to 50% of the total physical RAM.
You can increase or decrease the RAM limit using the .wslconfig
|
Configure WSL for application development
To use Visual Studio Code for application development:
-
Open the Ubuntu app from the Start menu.
-
Install the tools and packages needed for debugging applications:
$ sudo apt update && sudo apt upgrade -y $ sudo apt-get -y install build-essential gdb gdb-multiarch
-
Visit the Visual Studio Code page and download the Windows installer.
-
Follow the installation instructions to complete the setup.
-
Open Visual Studio Code and go to the Extensions view by clicking on the Extensions icon in the Activity Bar or pressing Ctrl+Shift+X.
-
Search for the Remote - WSL add-on and install it.
-
Press Ctrl+Shift+P to open the command palette.
-
Type Remote-WSL > New Window and select it. This opens a new VS Code window connected to your Ubuntu WSL instance.
-
VS Code automatically installs required server components in the WSL environment during the first launch. Follow any on-screen instructions to complete the setup.
-
Follow the steps in Develop with Visual Studio Code#,gpio-example to start debugging an application.