Step 7: Install WSL on Visual Studio Code and Upgrade to WSL2
Last updated
Last updated
The Windows Subsystem for Linux (WSL) allows you to run a Linux environment directly on Windows, without the overhead of a traditional virtual machine or dual-boot setup. Installing WSL and upgrading to WSL2 enhances performance and supports full system call compatibility, which is crucial for development tasks.
Install WSL on Visual Studio Code
Enable WSL on Windows:
Before installing a Linux distribution, you must enable the Windows Subsystem for Linux feature. Open PowerShell as Administrator and run:
Install Your Linux Distribution of Choice (Ubuntu):
Open the Microsoft Store and search for Ubuntu. Select the version you wish to install (e.g., Ubuntu 20.04 LTS) and click "Get" to install it.
Once installed, launch Ubuntu from the Start menu, and you'll be prompted to create a user account and password.
Upgrade to WSL2
Ensure Your System Supports WSL2:
WSL2 requires Windows 10 version 1903 or higher. Ensure your Windows is up to date.
Download the Linux Kernel Update Package:
Follow the instructions at Microsoft's official guide to download and install the Linux kernel update package for WSL2.
Set WSL2 as Your Default Version:
Open PowerShell as Administrator and run:
This command sets WSL2 as the default version for any future Linux distribution installations.
Verify Installation:
To confirm that WSL2 is installed and running, you can open your Linux distribution (e.g., Ubuntu) and run:
This command should display a Linux kernel version indicating that WSL2 is actively running.
Install WSL Extension in VSC
Navegate to "Extensions" tab in VSC and search for "WSL"; install the extension: