THE FOUNDER’S GUIDE:
How to Install Programs With a Graphical User Interface in WSL2
The condensed tutorial with instructions and screenshots
The expanded version of this article explains each step with enough detail to learn what’s happening.
Download VcXsrv:
- Visit the official website
- Click “Download”
Install VcXsrv:
- Open “vcxsrv-64.1.20.8.1.installer.exe”
- Click “Next”
- Click “Install”
- Click “Close”
Allow Access to VcXsrv:
- Check “Private Networks”
- Click “Allow Access”
Open PowerShell:
- Press “⊞ Windows”
- Enter “PowerShell” into the search bar
- Right-click “Windows PowerShell”
- Click “Run as Administrator”
Open the Bash Configuration File:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
notepad //wsl$/Ubuntu-18.04/home/$USER/.bashrc
Set the Display Variable:
- Find the arrow from below these instructions
- Copy the code to the left of the arrow
- Paste the code into Notepad
- Click the “File” menu
- Click “Save”
export DISPLAY=$(awk '/nameserver / {print $2; exit}' /etc/resolv.conf 2> /dev/null):0
Disable Indirect Rendering:
- Find the arrow from below these instructions
- Copy the code to the left of the arrow
- Paste the code into Notepad
- Click the “File” menu
- Click “Save”
- Click the “File” menu
- Click “Exit”
export LIBGL_ALWAYS_INDIRECT=0
Exit WSL:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
exit
Name the Task:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
$name = "Graphical User Interface (WSL2)"
Specify the Action:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
$action = new-scheduledtaskaction -execute "c:\program files\vcxsrv\vcxsrv.exe" -argument "-ac -nowgl -multiwindow -dpms"
Specify the Trigger:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
$trigger = new-jobtrigger -atstartup -randomdelay(new-timespan -seconds 30)
Run as the User:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
$principal = new-scheduledtaskprincipal -userid $env:username -runlevel highest
Remove the Time Restriction:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
$settings = new-scheduledtasksettingsset -executiontimelimit 0
Register the Task:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
- Restart the computer
register-scheduledtask -taskname $name -action $action -trigger $trigger -principal $principal -settings $settings
Open PowerShell:
- Press “⊞ Windows”
- Enter “PowerShell” into the search bar
- Right-click “Windows PowerShell”
- Click “Run as Administrator”
Open WSL:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
wsl
Install Firefox:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
sudo apt install firefox
Open Firefox:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
firefox https://whatsmyos.com/
Next Steps:
This article is part of a mini-series that helps readers set up everything they need to start using WSL2 for artificial intelligence, machine learning, deep learning, and or data science. It includes articles that contain instructions with copy and paste code and screenshots that help readers get the outcome as soon as possible. It also includes articles that contain instructions with explanations and screenshots that help readers process what’s happening.
01. Install Windows Subsystem for Linux 2 (WSL2)
02. Install the NVIDIA CUDA Driver and Toolkit in WSL2
03. Install Software From Source Code in WSL2
04. Install the Jupyter Notebook Home and Public Server in WSL2
05. Install Virtual Environments in Jupyter Notebook in WSL2
06. Install Programs With a Graphical User Interface in WSL2
07. Install Ubuntu Desktop With a Graphical User Interface in WSL2
Hopefully, this article helped everyone get the prize. If you want to help out then hold the “👋” and click “Follow” to get more content. Thanks for reading!