I built an Ubuntu environment on Windows 10 using WSL2.

1.First of all

I built an environment because my company lent me a Windows PC and I wanted an Ubuntu environment for my own PC as well.

2 What is WSL2?

The Windows Subsystem for Linux (WSL) is a compatibility layer for native execution of Linux (ELF format) binary executables on Windows 10 and Windows Server. Source: Windows Subsystem for Linux-Wikipedia


In the past, if you wanted to use Linux with a Windows OS, you had to install it as a virtual machine environment. However, the virtual machine environment has some overhead for operation and takes a long time to start. (Omitted) The startup load of WSL itself is small, and the startup time is extremely short. Source: [[Introduction to WSL] Part 1 Windows 10 Standard Linux Environment Let's Start WSL: IT Classroom-@IT](https://www.atmarkit.co.jp/ait/articles/1903/18/news031 .html)

WSL2 is the newer version of WSL. It is an abbreviation of Windows Subsystem for Linux, and if you use it, you can create a high-performance Linux environment on Windows without starting a virtual machine.

3 Environment construction

We will build the environment by referring to the following sites.

Using Linux on Windows 10 (WSL2)-Qiita

3.1 Installation of WSL2

As an administrator, enable WSL by doing the following:

PS C:\windows\system32> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Deployment image services and management tools
version: 10.0.18362.1139

Image version: 10.0.18363.1198

The function is enabled
[==========================100.0%==========================]
The operation completed successfully.

Then enable the Virtual Machine Platform. Select Y in Reboot or reboot.

PS C:\windows\system32> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all

Deployment image services and management tools
version: 10.0.18362.1139

Image version: 10.0.18363.1198

The function is enabled
[==========================100.0%==========================]
The operation completed successfully.
Please restart Windows to complete this operation.
Would you like to restart your computer now? (Y/N)

Now you are ready to install WSL. Let's go to the download site.

WSL 2 Linux Kernel Update | Microsoft Docs

Click "Download the latest WSL2 Linux kernel update package" to install it. If you press Next properly, it will end.

Now open PowerShell again and run the following command to set it to use WSL2 by default.

PS C:\Users\komums> wsl --set-default-version 2
For the main differences from WSL 2, https://aka.ms/See wsl2

3.2 Ubuntu Download

With the work so far, Ubuntu is finally ready to use. Install from the Windows Store.

Get Ubuntu-Microsoft Store ja-JP

After the installation is complete, let's start it. Set the Ubuntu user ID and password at the first startup, and the environment construction is completed.

Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: komums
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 4.19.128-microsoft-standard x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Tue Nov 17 08:24:47 JST 2020

  System load:  0.13               Processes:             8
  Usage of /:   0.4% of 250.98GB   Users logged in:       0
  Memory usage: 0%                 IPv4 address for eth0: 192.168.28.107
  Swap usage:   0%

1 update can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable


The list of available updates is more than a week old.
To check for new updates run: sudo apt update


This message is shown once once a day. To disable it please create the
/home/komums/.hushlogin file.

After that, install Windows Terminal or VS Code and enjoy a fun WSL life!

4 Finally

With this, it is safe to buy a Windows PC again in the future.

Please also follow Twitter!

Recommended Posts

I built an Ubuntu environment on Windows 10 using WSL2.
[Windows] WSL2 + Ubuntu + Node.js environment construction
Using Docker on Windows10 Home WSL2
Using JupyterLab + Java with WSL on Windows 10
Try running ScalarDB on WSL Ubuntu (Environment Construction)
Set up an SSH server on WSL2 Ubuntu 20.04
ubuntu on wsl part 10
Easily build Redmine on Windows using WSL2 and Docker
I tried using YOLO v4 on Ubuntu and ROS
I tried using Docker Desktop for Windows on Windows 10 Home
I installed CentOS 8 on Windows 10 using VirtualBox and Vagrant
I tried to build an environment using Docker (beginner)
Install Ubuntu 20.04 in virtual box on windows10 and build a development environment using docker
A memo when building a Rails 5.2 development environment using Docker Desktop + WSL2 on Windows 10 Home
Create an environment where CircleCI can be executed locally with Windows10 + WSL2 (Ubuntu) + Docker
Eh !? Run Linux on Windows? I can do it! !! (I set WSL2 and put Ubuntu)
Using Flutter on Ubuntu (Part 2)
Ubuntu on Windows Community Preview
Install Java on WSL Ubuntu 18.04
Ruby installation on WSL2 + Ubuntu 20.04
Ubuntu on Windows build speed
Use Java Web Start in an OpenJDK environment on Windows
Configuration script for using docker in proxy environment on ubuntu 20.04.1
How to create an environment that uses Docker (WSL2) and Vagrant (VirtualBox) together on Windows
I built an environment to execute unit tests using Oracle database (oracle12c) on the Docker in Docker (dind) image of GitLab-CI.
Until you put Ubuntu 20 on Windows 10 Home and WSL2 and run Docker
Using Azure IOT Hub on Ubuntu 20.10.
Install ngrok on ubuntu16.04 using Vagrant
A note when I was addicted to converting Ubuntu on WSL1 to WSL2
Build a XAMPP environment on Ubuntu
Elmer / Ice installation (Ubuntu on WSL)
Build ffmpeg 4.3.1 on Ubuntu for Windows
Installing and using Ansible on Ubuntu 16.04
I introduced WSL2 + Ubuntu to Window10 and tried using GDC, DMD, LDC
01. I tried to build an environment with SpringBoot + IntelliJ + MySQL (MyBatis) (Windows10)
I want to mess with Permission of Windows directory from WSL (ubuntu)
Windows Docker: Disk pressure on WSL files
WSL2 + Ubuntu 20.04 Install Vivado in LTS environment
I tried running Docker on Windows Server 2019
Run NordVPN on Docker (Windows) Ubuntu container
Use docker in proxy environment on ubuntu 20.04.1
I want to install PHP 7.2 on Ubuntu 20.04.
Introducing Docker Desktop for Windows on WSL2
[Ruby] Building a Ruby development environment on Ubuntu
Use cljstyle with Spacemacs on Ubuntu on WSL2
Microservices 101-I tried putting Docker on Ubuntu-
Send an email using JavaMail on AWS
Try putting Docker in ubuntu on WSL
Build an environment with Docker on AWS
Modern Java environment for Windows using Chocolatey
Build an Ultra96v2 development environment on Docker 1
I installed WSL2 without using Microsoft Store and tried to build an environment where Docker can be used
I built a Java EE environment on AWS and tried running a web application
Creating an SSL certificate using Let's Encrypt and setting up Nginx on Ubuntu 20
I was addicted to using RXTX on Sierra
I tried using Junit on Mac VScode Maven
Using JUnit from the command line on Ubuntu
Protobuf and gRPC C ++ environment construction on Ubuntu 18.04
Android application development using Unity + ARCore on Ubuntu
[Ubuntu 18.04] Environment construction for using PyTorch with RTX3090
[Java] Build Java development environment on Ubuntu & check execution