The Founder’s Guide:

How to Install Ubuntu Desktop With a Graphical User Interface in WSL2

The condensed tutorial with instructions and screenshots

David Littlefield
7 min readDec 12, 2020
Image by Author

“Attention: This article has been rewritten to simplify the process and include updates to the process. See updated article here.”

Download VcXsrv:

  1. Visit the official website
  2. Click “Download”

Install VcXsrv:

  1. Open “vcxsrv-64.1.20.8.1.installer.exe”
  2. Click “Next”
  3. Click “Install”
  4. Click “Close”

Allow Access to VcXsrv:

  1. Check “Private Networks”
  2. Click “Allow Access”

Open PowerShell:

  1. Press “⊞ Windows”
  2. Enter “PowerShell” into the search bar
  3. Right-click “Windows PowerShell”
  4. Click “Run as Administrator”

Change the Execution Policy:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
Set-ExecutionPolicy Unrestricted -Force

Open WSL2:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
wsl

Install Ubuntu Desktop:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
sudo apt --yes install ubuntu-desktop

Set the Username Variable:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
username=$(wslvar USERNAME)

Create the Ubuntu Directory:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
mkdir --parents /mnt/c/users/$username/.ubuntu/

Open the Ubuntu Directory:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
cd /mnt/c/users/$username/.ubuntu

Get the Microsoft Public Key:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
sudo apt-key adv --fetch-keys https://packages.microsoft.com/keys/microsoft.asc

Add Microsoft to the Source List Directory:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. 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:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
sudo apt update

Download .Net 5.0 Runtime:

  1. Visit the official site
  2. Click “Download x64”

Install .Net 5.0 Runtime:

  1. Click the “Windowsdesktop-runtime-5.0.5-win-x64.exe” file
  2. Click “Next”
  3. Click “Close”

Enter the Shell as the Root User:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
sudo --shell

Install Apt Transport HTTPS:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
apt install apt-transport-https

Download the GPG Key:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. 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:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
chmod a+r /etc/apt/trusted.gpg.d/wsl-transdebian.gpg

Add Arkane Systems to the Source List Directory:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. 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:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
apt update

Exit the Shell as the Root User:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
exit

Install Genie:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
sudo apt install --yes systemd-genie

Add Genie to the Sudoers Directory:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
echo "$USER ALL=(ALL) NOPASSWD:/usr/bin/genie" | sudo EDITOR="tee" visudo --file /etc/sudoers.d/$USER

Create the Desktop Environment Script:

  1. Copy the code from below these instructions
  2. Paste the code into PowerShell
  3. Press “Enter”

Download the Ubuntu Design Images:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
wget https://assets.ubuntu.com/v1/9fbc8a44-circle-of-friends-web.zip

Install Unzip:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
sudo apt --yes install unzip

Unzip the Ubuntu Design Images:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
unzip 9fbc8a44-circle-of-friends-web.zip

Install ImageMagick:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
sudo apt --yes install imagemagick

Create the Ubuntu Icon:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
convert -resize 64x64 ./circle-of-friends-web/png/cof_orange_hex.png ubuntu.ico

Exit WSL2:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
exit

Create the VcXsrv Script:

  1. Copy the code from below these instructions
  2. Paste the code into PowerShell
  3. Press “Enter”

Create the Ubuntu Desktop Script:

  1. Copy the code from below these instructions
  2. Paste the code into PowerShell
  3. Press “Enter”

Create the Shortcut Icon:

  1. Copy the code from below these instructions
  2. Paste the code into PowerShell
  3. Press “Enter”

Open the Ubuntu Directory:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
cd $HOME\.ubuntu

Launch Ubuntu Desktop:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
  4. Double-click the “Ubuntu” shortcut
  5. Wait 180 seconds for Ubuntu Desktop to boot up
explorer.exe .\

Open Terminal:

  1. Click “Activities” in the top-left corner
  2. Enter “Terminal” into the search bar
  3. Click “Terminal”

Disable the Screen Lock:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Enter”
gsettings set org.gnome.desktop.lockdown disable-lock-screen true

Install the Snap Store:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. 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!

--

--

David Littlefield
David Littlefield

Written by David Littlefield

From: Non-Technical | To: Technical Founder | Writes: To Make It Easier For Everyone | Topics: #Startups #How-To #Coding #AI #Machine Learning #Deep Learning

Responses (1)