With Windows Subsystem for Linux 2 (WSL2) on Windows 10, you can play Linux on Windows 10 very easily.
How to Install
winver
command.Open powershell as administrator and do the following:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Open powershell as administrator and do the following: You will be asked if you want to restart your PC, so enter Y
. The PC will restart automatically.
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all
Download and install the Linux kernel for WSL2 from the Update WSL 2 Linux Kernel (https://docs.microsoft.com/en-us/windows/wsl/wsl2-kernel) page.
Set to use WSL2 by default when installing a Linux distribution. Open powershell and do the following:
wsl --set-default-version 2
2. Click the "Get" button to install Ubuntu 3. After the installation is complete, click "Start" to start Ubuntu! 4. Set the Ubuntu user ID and password at the first startup, and the installation is completed. The user name you enter here has nothing to do with your Windows user name. If you need root privileges, you can run it with sudo. If you have forgotten your password, see Forgot Password.
How to use
The installed Linux distribution can be started from the start menu in the same way as a normal application. Start while logged in as the created user.
In Windows Terminal, the WSL2 profile is automatically registered, so you can easily access it. So recommended. You can install it from the Microsoft Store, so if you are interested, give it a try.
Windows C drive is mounted on Linux / mnt / c
. You can access files on Windows by accessing / mnt / c
.
You can access files on Linux with \\ wsl $ \ [distribution name]
. If you are using Ubuntu, access it with \\ wsl $ \ Ubuntu
.
I've been using it for a while and noticed that the Ubuntu time on WSL2 is shifting quite a bit. Apparently, Ubuntu isn't syncing with the Note PC when it wakes up from sleep. It seems to be a known issue and has not been fixed yet. (WSL2 date incorrect after waking from sleep)
As a workaround, use sudo hwclock -s
to forcibly synchronize the time or use wsl --shutdown
to stop WSL2 and then start it. For the time being, I try to execute sudo hwclock -s
every time I log in as shown below.
sudo visudo
command and edit the / etc / sudoers
file as shown below.# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/hwclock -s #Add this line
.bashrc
file in your home directory# sync HW clock
sudo hwclock -s
How to Uninstall
Installed Linux distributions can be uninstalled from Add or Remove Programs
just like regular applications.
You can browse the list of installed distributions, uninstall, etc. with the wsl
command from the command prompt.
C:\>wsl -l -v
NAME STATE VERSION
* Ubuntu-20.04 Running 2
WSL related resources. You can access all the information from here.
WSL2 installation procedure.
Recommended Posts