- Install the free new VMware Tanzu Community Edition - Fri, Nov 12 2021
- How to migrate VCSA to a new host without VMotion - Fri, Nov 5 2021
- New free VMware tool: Virtual Machine Desired State Configuration (VMDSC) - Fri, Oct 22 2021
It is already the second release of Windows Subsystem for Linux (WSL) that Microsoft released a short time ago. This release offers a new architecture that changes the way in which the Linux distribution interacts with the underlying Windows OS.
WSL 2 has better performance and full system call compatibility. It uses virtualization technology (based on Hyper-V) and a lightweight utility VM on a real Linux kernel. You will need to install two components: the WSL and the Virtual Machine platform optional component.
The Linux kernel in WSL 2 is built by Microsoft from the latest stable branch of the source available at kernel.org. This kernel has been specially optimized for WSL 2 in terms of size and performance to get the best possible Linux experience on Windows. The kernel will be updated via Windows updates, so you'll get the latest security fixes without worrying by patching this separately.
To get access to Windows Server 2019 19035, you'll have to join the Windows Insider program at Microsoft and select 'Fast' ring or 'Slow' ring. You can join for free.
The first thing to do is install the WSL via PowerShell as an administrator. Open your PowerShell console and enter this command:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Then install the Virtual Machine platform optional component:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
A reboot is required to ensure that WSL can initiate a trusted execution environment. Just to make sure that WSL is installed, you can confirm the installation via this PowerShell command:
Get-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
The next step is to download your Linux distribution. In our example, we'll use Ubuntu.
Use this command:
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile ~/Ubuntu1804.zip -UseBasicParsing
When done, create a local folder where you'll extract the zip archive file:
Then extract the zip file into a folder on your local hard drive.
Expand-Archive c:\users\administrator\Ubuntu1804.zip C:\Linux\Ubuntu
Launch the Ubuntu.exe file to install it (installation might take a while). You'll receive a prompt to create a new user and assign a password. This has to be some user other than root and the user's name has to be lowercase only.
Update the package catalog and the individual applications with the "apt update" and "apt upgrade" commands if you're on an Ubuntu/Debian distribution. You'll need to use "sudo" to elevate your privileges.
If you're new to Linux, the command would look like this:
sudo apt update
You'll receive a prompt for a password for user vladan we created earlier.
Wait for this to finish and then run "sudo apt upgrade" to update all installed packages to the latest version. You should do this from time to time to have the latest versions installed.
You can check which Linux distributions are already installed with this command:
You can set the Ubuntu WSL to version 2 with this command:
wsl --set-version Ubuntu-18.04 2
WSL will convert the Linux distribution to version 2. WSL 2 uses an entirely new architecture that uses a real Linux kernel. It's a good idea to try to use the latest and greatest.
We can also make sure that whenever we install a new distro, it will default to version 2. To do so, just run this command via PowerShell:
Subscribe to 4sysops newsletter!
wsl --set-default-version 2
You can run WSL 1 and WSL 2 distributions side by side. At any time, you can upgrade and downgrade any distribution if needed. WSL 2 as a new architecture presents a better platform but WSL as such will be improved over time. WSL is great for developers and testers when they need to work on Windows systems and develop and test Linux applications at the same time.