Setting up WSL2 (Windows Subsytem for Linux) on Windows 10
Due to my continuing education activities (study Master Cloud Computing Engineering) I have again to deal with Linux/Unix.
Especially I want to refresh my " Bash skills ".
However, in order to be able to start with that, it is necessary to create a training environment.
This can be achieved in many different ways (if you are basically at home in Windows).
- Linux/Unix-based virtual machine (desktop virtualization)
- Windows Subsystem for Linux (WSL)
I decided to use the new variant via WSL, because in this case integration with the underlying hardware is closer.
Furthermore it is a new approach to work with Linux under Windows and we all want to learn something "new"? ;)
Requirements:
If you don't meet this requirements, please go ahead and start upgrading / updating.
Installation:
Please execute the following commands in an administrative PowerShell to install the needed Windows-Feature.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
After all this is done, it is time to restart.
Via the Windows Store you can then download and install a suitable and compatible Linux\Unix version.
Available here are for example:
- Alpine Linux
- Ubuntu
- Debian
- ......
After the installation the new Linux is available.
Now of course the question arises how to access it.
- via PowerShell using the prefix "wsl"
wsl --list --all
# This command shows the currently (default) installed Linux Subsystems
- via Powershell entering into the default Linux Subsystem
wsl
- via "Windows Terminal"
It should also be mentioned here that the WSL requires a standard user and password on first access. So your access experience the first time here might differ a bit from the process shown...
I recommend to work with the new shell created by Microsoft: "Windows Terminal."
I have already written about this:
FAQ:
If you get the following error message:
WSL 2 requires an update to its kernel component. For information please visit https://aka.ms/wsl2kernel
Then you should install this package:
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
References:
https://docs.microsoft.com/en-us/windows/wsl/install-win10