How to run GUI apps trough WSL?

ivayloiv

Ivaylo Ivanov

Posted on January 18, 2022

How to run GUI apps trough WSL?

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.

Note: If you have wsl 1 installed skip to step 2, otherwise follow the steps as it is.

1. Installing WSL.

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
Enter fullscreen mode Exit fullscreen mode

If the command has been executed successfully restart your machine and continue to step 2.

2. Enabling Virtual Machine Feature and installing WSL 2 version.

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
Enter fullscreen mode Exit fullscreen mode

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.

3. Running GUI apps through WSL.

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
Enter fullscreen mode Exit fullscreen mode

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.

πŸ’– πŸ’ͺ πŸ™… 🚩
ivayloiv
Ivaylo Ivanov

Posted on January 18, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related