Hi, guys today I will show you how to run GUI apps through WSL. As you know by default WSL 1 offers just a terminal of the selected Linux distro but in WSL 2 there are some changes and you are going to be able to run GUI applications through WLS 2 directly in windows. Without further due let's hop into the topic.
In case to install the WSL (windows subsystem for Linux), you will need administrator permissions on your machine. After that, you will have to open the windows PowerShell as administrator and activate the wsl feature. To that just paste this command in ht PowerShell and hit enter.
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
If the command has been executed successfully restart your machine and continue to step 2.
After everyone has WSL installed, in case to switch to WSL 2 you will need to enable A special built-in virtual machine for wsl 2. To do that just paste this into your PowerShell (opened as administrator)
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
After you have enabled the virtual machine feature, it is time to install the WSL version 2. To do that, download the latest kernel update here. It is an official Microsoft executable, that you can run just by double-clicking after you install it. It is time for the final step - Running GUI apps through WSL on windows.
We are almost finished this is the last step to do, I promise. To be able to run any graphical app through WSL you will need a graphics card driver in addition. You can download the special driver for either GeForce or Quadro series graphics cards. Wait for it to download, then install it by double-clicking. After it is installed it is good to practice rebooting your machine. After you have it rebooted you can install any application on your WSL Linux Distro, for example, "Firefox".
sudo apt install firefox
After the installation is completed you can simply run the application, in our case, it is firefox so we are going to run it by typing in the command line
firefox. Wait for it for some time because it is the first launch and if everything has been set up as it should, you should be prompted with the firefox application directly on your windows screen, running through WSL.
Congratulations you have successfully set up WSL 2 and enabled GUI on trough WSL. 🎉🎺🎉
If you have any questions, just leave a comment, I will answer as soon as possible.