3

How to run GUI apps trough WSL?

 2 years ago
source link: https://dev.to/ivayloiv/how-to-run-gui-apps-trough-wsl-9oa
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK