The Founder’s Guide:
How to Install Ubuntu Desktop With a Graphical User Interface in WSL2
The condensed tutorial with instructions and screenshots
“Attention: This article has been rewritten to simplify the process and include updates to the process. See updated article here.”
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”
Change the Execution Policy:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
Set-ExecutionPolicy Unrestricted -Force
Open WSL2:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
wsl
Install Ubuntu Desktop:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
sudo apt --yes install ubuntu-desktop
Set the Username Variable:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
username=$(wslvar USERNAME)
Create the Ubuntu Directory:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
mkdir --parents /mnt/c/users/$username/.ubuntu/
Open the Ubuntu Directory:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
cd /mnt/c/users/$username/.ubuntu
Get the Microsoft Public Key:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
sudo apt-key adv --fetch-keys https://packages.microsoft.com/keys/microsoft.asc
Add Microsoft to the Source List Directory:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
Ubuntu 20.04:
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/ubuntu/20.04/prod focal main" > /etc/apt/sources.list.d/microsoft-prod.list'Ubuntu 18.04:
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main" > /etc/apt/sources.list.d/microsoft-prod.list'
Update the Repositories:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
sudo apt update
Install .Net 5.0 Runtime:
- Click the “Windowsdesktop-runtime-5.0.5-win-x64.exe” file
- Click “Next”
- Click “Close”
Enter the Shell as the Root User:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
sudo --shell
Install Apt Transport HTTPS:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
apt install apt-transport-https
Download the GPG Key:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
wget --output-document /etc/apt/trusted.gpg.d/wsl-transdebian.gpg https://arkane-systems.github.io/wsl-transdebian/apt/wsl-transdebian.gpg
Change the Access Permissions:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
chmod a+r /etc/apt/trusted.gpg.d/wsl-transdebian.gpg
Add Arkane Systems to the Source List Directory:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
cat << EOF > /etc/apt/sources.list.d/wsl-transdebian.list
deb https://arkane-systems.github.io/wsl-transdebian/apt/ $(lsb_release -cs) main
deb-src https://arkane-systems.github.io/wsl-transdebian/apt/ $(lsb_release -cs) main
EOF
Update the Repositories:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
apt update
Exit the Shell as the Root User:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
exit
Install Genie:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
sudo apt install --yes systemd-genie
Add Genie to the Sudoers Directory:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
echo "$USER ALL=(ALL) NOPASSWD:/usr/bin/genie" | sudo EDITOR="tee" visudo --file /etc/sudoers.d/$USER
Create the Desktop Environment Script:
- Copy the code from below these instructions
- Paste the code into PowerShell
- Press “Enter”
Download the Ubuntu Design Images:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
wget https://assets.ubuntu.com/v1/9fbc8a44-circle-of-friends-web.zip
Install Unzip:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
sudo apt --yes install unzip
Unzip the Ubuntu Design Images:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
unzip 9fbc8a44-circle-of-friends-web.zip
Install ImageMagick:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
sudo apt --yes install imagemagick
Create the Ubuntu Icon:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
convert -resize 64x64 ./circle-of-friends-web/png/cof_orange_hex.png ubuntu.ico
Exit WSL2:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
exit
Create the VcXsrv Script:
- Copy the code from below these instructions
- Paste the code into PowerShell
- Press “Enter”
Create the Ubuntu Desktop Script:
- Copy the code from below these instructions
- Paste the code into PowerShell
- Press “Enter”
Create the Shortcut Icon:
- Copy the code from below these instructions
- Paste the code into PowerShell
- Press “Enter”
Open the Ubuntu Directory:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
cd $HOME\.ubuntu
Launch Ubuntu Desktop:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
- Double-click the “Ubuntu” shortcut
- Wait 180 seconds for Ubuntu Desktop to boot up
explorer.exe .\
Open Terminal:
- Click “Activities” in the top-left corner
- Enter “Terminal” into the search bar
- Click “Terminal”
Disable the Screen Lock:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Enter”
gsettings set org.gnome.desktop.lockdown disable-lock-screen true
Install the Snap Store:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Enter”
sudo snap install snap-store
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 to help readers get the outcome as fast as possible. It also includes articles that contain instructions with explanations and screenshots to help readers understand 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!