Install Windows Services for Linux on Windows 11
To install the Windows Services for Linux on Windows 11, run the wsl --install
command, this requires elevated privileges so run the Windows Terminal as Administrator to accomplish this.
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Install the latest PowerShell for new features and improvements! https://aka.ms/PSWindows PS C:\Users\Intel i5> wsl --install Installing: Virtual Machine Platform Virtual Machine Platform has been installed. Installing: Windows Subsystem for Linux Windows Subsystem for Linux has been installed. Downloading: WSL Kernel Installing: WSL Kernel WSL Kernel has been installed. Downloading: GUI App Support Installing: GUI App Support GUI App Support has been installed. Downloading: Ubuntu The requested operation is successful. Changes will not be effective until the system is rebooted. PS C:\Users\Intel i5> |
After the reboot, the installation of the default Ubuntu distribution will begin. This is very simple to do.
I had an error when installing Ubuntu, this was due to the Hypervisor not running.
Error 0x80370102 The Virtual machine could not be started because a required feature is not installed.
These commands fixed the issue.
PS C:\Users\Intel i5> bcdedit /set hypervisorlaunchtype auto start PS C:\Users\Intel i5> wsl --set-default-version 1 |
Then I was able to install Debian GNU/Linux from the Microsoft Store.
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: jason New password: Retype new password: passwd: password updated successfully Installation successful! jason@DESKTOP-PF01IEE:~$ |
This is very painless. Once Linux is installed and running you are all set. Type the wsl command in the Windows Terminal to open the Linux shell.
PS C:\Users\Intel i5> wsl
jason@DESKTOP-PF01IEE:/mnt/c/Users/Intel i5$ ls
AppData Documents ‘Local Settings’ NTUSER.DAT{1c2b59c6-c5f5-11eb-bacb-000d3a96488e}.TM.blf ntuser.ini ‘Saved Games’ Videos
‘Application Data’ Downloads Music NTUSER.DAT{1c2b59c6-c5f5-11eb-bacb-000d3a96488e}.TMContainer00000000000000000001.regtrans-ms OneDrive Searches
Contacts Favorites ‘My Documents’ NTUSER.DAT{1c2b59c6-c5f5-11eb-bacb-000d3a96488e}.TMContainer00000000000000000002.regtrans-ms Pictures SendTo
Cookies Heaven NetHood ntuser.dat.LOG1 PrintHood ‘Start Menu’
Desktop Links NTUSER.DAT ntuser.dat.LOG2
The ability to run Linux within Windows is very nice, this allows testing various applications on a stable platform in a window is awesome. Access your C drive via the /mnt/c mount point.
jason@DESKTOP-PF01IEE:/mnt/c/Users/Intel i5/Documents$ ls 'Arma 3' frag 'My Music' 'My Videos' SideSync desktop.ini GZDoom_Builder-r2787 'My Pictures' OP-2.1 Ubuntu jason@DESKTOP-PF01IEE:/mnt/c/Users/Intel i5/Documents$ |
This would be very useful to work on video files using FFmpeg that are located on your C drive.
Get your IP address this way.
jason@DESKTOP-PF01IEE:/mnt/c/Users/Intel i5/Documents$ ip a | awk 'NR==3{print $2}' 192.168.1.114/24 |
Run the sudo apt update
command and then the sudo apt upgrade
command to install any pending updates. Then you are ready to use Linux. Windows Services for Linux is not new, Windows Services for UNIX was around since Windows Server 2008. It allowed a UNIX command-line within the Windows Server operating system. But the initial release was in 1999, 22 years ago. But it is really coming into its own in 2021. This is a most useful framework. You can even install an Apache web server and have a server to test a web application easily.
I used this command to watch TV in the terminal.
jason@DESKTOP-PF01IEE:/mnt/c/Users/Intel i5/Documents$ mpv --vo=tct https://i.mjh.nz/au/Sydney/tv.320203000303.m3u8 |
This video display was quite watchable and this is quite an interesting trick.