I built an environment because my company lent me a Windows PC and I wanted an Ubuntu environment for my own PC as well.
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.
We will build the environment by referring to the following sites.
Using Linux on Windows 10 (WSL2)-Qiita
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
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!
With this, it is safe to buy a Windows PC again in the future.
Please also follow Twitter!