Thus, it was no longer a question of ensuring a conversion and partial management, but of embarking on everything necessary to find what makes a complete Linux system, virtualized under Windows.
What fundamentally change the WSL experience, while keeping what makes its strength: a very fast launch, without specific tool or configuration of a virtual machine having access only to a portion of the power of the host machine. But WSL 2 mainly brings new possibilities, documented over the months (such as memory management).
Here again, the rapprochement with Canonical was essential, the two companies communicating hand in hand on what WSL 2 allows, through blog posts and other videos:
A full playlist from Canonical and Microsoft discussing WSL 2
The same is true for Docker, which thus offers prime access to its tools for developers on Windows, who can now very easily use them, interface them with Visual Studio Code, etc.
WSL 1 and 2 are for the moment intended to coexist, the use of the first being sometimes more relevant. For Microsoft, this is particularly the case "if you want to use your WSL Linux distribution to access project files in the Windows file system and these files cannot be stored in the Linux file system". In general, the WSL 1 file system is thus considered to be more efficient for the moment “if you use Windows applications to access Linux files”.
But WSL 2's file system provides better performance when using Linux files from Linux applications. The conversion of permissions from one to the other and its parameters are detailed here.
Contrary to what is indicated by Microsoft, recent versions of VMWare and VirtualBox can coexist with Hyper-V/WSL
Making Windows 10 THE desktop Linux distribution for developers
Microsoft took advantage of this period to work in parallel on its new Terminal, also completely redesigned and taking advantage of what makes the success of many applications of its kind: more extensive character management, graphic acceleration, possibility of opening several tabs and panels , customize the interface, etc.
Next step: the package manager, with WinGet (which still requires work). Would the publisher want to make Windows 10 the first desktop Linux distribution? Somehow. But above all, he wants developers to find the best of both worlds in his OS, to encourage them to stay there.
A long-term work, finding its first public implementation with Windows 10 May 2020, which will continue with the support of GPUs for calculation, graphical interfaces, etc. Note that Visual Studio Code has been specially adapted to take advantage of the Linux subsystem. A specific extension is thus offered to users (in preview): Remote - WSL. Its detailed documentation is available here.
Install and configure WSL 2
Activating the Linux subsystem has never been a perfectly simple and smooth process. This isn't much of a problem for a tool aimed primarily at developers, but Microsoft has already promised that this will change in a future version of Windows 10, with a single command being sufficient. So much the better.
Until then, it still requires a little manual work. The v2 has also not arranged anything since it requires virtualization to be activated on the system. This can also pose some problems, especially for users already in a virtualized environment (like a Shadow PC for example). But also those who use AMD's Ryzen Master management tool which refuses to be launched on a machine where virtualization is active, go find out why.
First, you need to enable the Linux subsystem and the virtual machine platform in the list of Windows features ( OptionalFeatures.exe
). You can also go through these PowerShell commands (Administrator):
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestartdism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
Then restart your machine. Since WSL v1 and v2 coexist, a distribution can be installed in either version, converted from one to the other, etc. By default, v1 is used. For it to be v2, the Linux kernel must be installed. It's not yet automatic, so you have to download it:
Once this is done, validate this command:
wsl --set-default-version 2
You can then go to the Microsoft Store or follow the manual procedure to download and install the distribution of your choice like Alpine, Debian, Kali Linux, OpenSUSE, Ubuntu, etc.
Here is a list of some useful commands:
wsl // run the default distribution in WSLwsl -l // display the list of installed distributions--all // even those being (un)installed--running // only the current ones-- quiet // only the names -- verbose // full detailswsl -s distribution // set default distribution to use/runwsl --set-version distribution version // convert a distribution to WSL (1) or WSL 2 (2)wsl --shutdown // stop all distributions and the WSL VM 2wsl -t distribution // stop a specific distribution
You can also ask a distribution to run a specific command:
wsl -e command-d distribution // target a specific distribution -u user // target a specific user
Distributions can be exported and imported via an archive in TAR format, for WSL v1 or v2:
wsl --export distribution wslfile --import distribution_name destination_folder file --version 1/2
By default, the storage space goes through a virtual hard disk (VHD), allocated up to a maximum of 256 GB. If you should need a higher quota, you will have to go through a specific, detailed procedure. here. You can also limit access to resources: memory (80% by default), CPU cores, etc. The procedure is detailed here.
Access files and network of a WSL 2 distribution
The files of Linux distributions are accessible from your system disk in the explorer, but to avoid any conflict, the most effective is to use the interface set up by Microsoft. For this, two solutions are available to you. The first allows you to open the file explorer in the current directory from the WSL bash:
explorer.exe .
In the latter, you can also go to the network location \\wsl$\
which will display all the Linux distributions on the system accessible via WSL and currently active. During the Windows 10 May 2020 beta, adding a Linux section to File Explorer was mentioned, but it is not yet present.
If Visual Studio Code is installed on the machine, you can launch it by opening the current folder with a simple command (see above). Also remember to install the Remote - WSL extension.
coded .
From a network perspective, the different Linux distributions do not fetch their settings (IP, DNS, etc.) from your router and DHCP server. They are seen as part of the machine, with a Hyper-V virtual network device managing their IP address (172.xxx in our case), internet access, etc.
So if you expose services through Docker containers, HTTP server or whatever, they will be accessible from the host through the IP 127.0.0.1 (or localhost). But it is currently impossible to access it simply from another machine on your local network, and therefore to expose these services to the outside. Several methods (in particular via redirections) are nevertheless exploitable while waiting for Microsoft to improve the situation, in future versions.
Farewell Touch Bar, I won't regret...
Caddy, the only web server to use H...
Burkina Faso / Gabon (TV / Streamin...
What the future of work will not b...