Enable WSL 2 Feature in Windows 11 using VirtualBox
Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables natively on Windows 11. WSL 2 is the latest version, which uses a real Linux kernel for better performance and compatibility. In this article, we'll show you how to enable WSL 2 on Windows 11 using VirtualBox.
Prerequisites
Before we begin, ensure the following:
- You have a Windows 11 system with the latest updates installed.
- VirtualBox 7.0.22 or later is installed.
Install the WSL 2 Linux distribution
First, you need to install a Linux distribution in the WSL 2 environment. Microsoft recommends Ubuntu as the default distribution. You can install it using the Microsoft Store or the terminal.
Using Microsoft Store
Open the Microsoft Store application and search for "Ubuntu". Click "Get" to download and install it.
Using Terminal
Open the terminal (Windows key + X, then select "Windows Terminal (Admin)") and run the following command:
wsl --install UbuntuCheck WSL installation
Verify the WSL installation by running the following PowerShell command:
$wsl --list --verboseLook for the line that starts with "Ubuntu" and ensures it says "WSL 2" under the "Distribution" column.
Enable WSL 2 in VirtualBox
Now, we'll configure VirtualBox to use the WSL 2 backend for better performance and compatibility.
Install VirtualBox Extension Pack
First, you need to install the VirtualBox Extension Pack. Download it from the Oracle website and follow the installation instructions.
Create a new Linux Virtual Machine
Open VirtualBox and create a new Linux virtual machine. Select "Ubuntu" as the type and version, then click "Next".
Configure Virtual Machine
Assign the necessary resources like memory, CPU, and hard disk. Ensure the "Enable EFI (64-bit)" option is checked. Click "Next" to continue.
Configure Networking
Choose the networking mode according to your requirements and click "Next".
Create a new Virtual Hard Disk
Choose the type and size of the virtual hard disk, then click "Create" and "Next".
Set up the Linux installation media
Select the Ubuntu installation media (ISO file) and click "Next".
Start the installation process
VirtualBox will start the installation process. Follow the on-screen instructions to complete the installation.
Configure WSL 2 in VirtualBox
Now, we'll configure VirtualBox to use WSL 2 as the default backend for the Ubuntu virtual machine.
Open VirtualBox settings
Open the settings for the Ubuntu virtual machine.
Enable WSL 2 in VirtualBox
Go to the "System" tab, then click "Processes" and add the following command:
wsl --set-default-user Replace
Enable Secure Boot
Go to the "Security" tab and enable Secure Boot. Restart the virtual machine.
Enable WSL 2 in VirtualBox settings
Open the terminal (Windows key + X, then select "Windows Terminal (Admin)") and run the following command:
wsl --set-default-version 2Now, start the Ubuntu virtual machine from VirtualBox.
Check WSL 2 status
To check the WSL 2 status, run the following PowerShell command:
wsl --list --verboseLook for the line that starts with "Ubuntu" and ensures it says "WSL 2" under the "Distribution" column.
In this article, we learned how to enable WSL 2 on Windows 11 using VirtualBox. We covered the prerequisites, installed the Ubuntu distribution, checked the WSL installation, and configured VirtualBox to use WSL 2 as the default backend for the Ubuntu virtual machine.