Update your default distribution to Ubuntu-20.04, WSL 2

Introduction

WSL 2 overview

In 2020, Microsoft announced WSL 2. You can expect higher performance than the previous WSL 1. It also simplifies the GUI. : computer:

Details: Comparison of WSL 1 and WSL 2

Purpose

I want to switch the default distribution from Ubuntu-18.04 (WSL 1) to Ubuntu-20.04 (WSL 2).

procedure

1. Enable the Windows subsystem for Linux

Open PowerShell as an administrator. (Enter PowerShell in" Enter here to search "on the right side of the Start menu button. When PowerShell is displayed, right-click and select" Open from administrator ")

Enter the following command in PowerShell.

    dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

2. Make sure you meet the requirements to update your default distribution to WSL 2

You can check the version information of Windows you are using by entering winver in" Enter here to search "on the right side of the Start menu button and opening winver. Check if the following requirements are met.

For x64 systems: version 1903 or later, build 18362 or higher.

For ARM64 systems: version 2004 or later, build 19041 or higher.

If not, update Windows with Windows Update Assistant.

(By the way, the version of my PC was as follows and met the requirements.

Microsoft Windows Version 1909 (OS build 18363, 1082)

3. Reboot

Restart Windows.

4. Install the WSL2 Linux kernel update package

Download and run the WSL2 Linux kernel update package installer from here.

5. Get Ubuntu-20.04

Get Ubuntu-20.04 from the Microsoft Store.

6. Update the default version to WSL 2

Open PowerShell again from an administrator and enter the following command to update the default version to WSL 2 for Ubuntu-20.04.

wsl --set-version Ubuntu-20.04 2

7. Check if the default version has been updated

Check the default version by entering the following command in PowerShell.

wsl --list --verbose

It is OK if the output is as follows.

  NAME            STATE           VERSION
* Ubuntu-20.04    Running         2
  Ubuntu-18.04    Stopped         1

The one with * is the default distribution.

Also, make sure that Ubuntu-20.04 appears at the top when you type Ubuntu at the start.

Installation Guide for Windows Subsystem for Linux for Windows 10

Recommended Posts

Update your default distribution to Ubuntu-20.04, WSL 2
ubuntu on wsl part 10
WSL2 Ubuntu 20 can no longer apt-get, so what to do