Skip to content

Instantly share code, notes, and snippets.

@mathdroid
Last active August 21, 2024 02:47
Show Gist options
  • Save mathdroid/0c19b6b1c4478a6e54b6de8eb5746290 to your computer and use it in GitHub Desktop.
Save mathdroid/0c19b6b1c4478a6e54b6de8eb5746290 to your computer and use it in GitHub Desktop.
WSL2 Setup
# 0. open a PowerShell as administrator
# 1. Enable WSL
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
# 2. Enable VM Platform
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# 3. RESTART system, then open a PowerShell as administrator again
# MAKE SURE YOU HAVE RESTARTED BEFORE YOU CONTINUE
# 4. Set WSL 2
wsl --set-default-version 2
# if error: WSL 2 requires an update to its kernel component. For information please visit https://aka.ms/wsl2kernel
# go to the link and install wsl2 kernel
# 5. Install a Linux distribution
# - Open Windows Store, find Ubuntu 20.04, Install
# - Run Ubuntu
# Go to no. 6 in `2.ubuntu-steps.sh`
# 11. Install X server
# - VcXsrv https://sourceforge.net/projects/vcxsrv/ (RECOMMENDED, free)
# - x410 https://x410.dev/ (paid)
# 12. Download, install, launch VcXsrv
# - Pick "Multiple Windows", next
# - Pick "Start No Client", next
# - Check all boxes, including "Disable access control", finish
# - FIREWALL: allow VcXsrv to access your network
# Go to no. 13 in `2.ubuntu-steps.sh`
# setup user
# 6. Upgrade
sudo apt update && sudo apt -y upgrade
# 7. Install essentials
sudo apt install build-essential
sudo apt install net-tools
sudo apt install xrdp -y && sudo systemctl enable xrdp # remote desktop utilities
# 8. Setup GUI
sudo apt install -y tasksel
sudo tasksel install xubuntu-desktop
sudo apt install gtk2-engines
# 9. Export GUI config (add this to .bashrc)
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
export LIBGL_ALWAYS_INDIRECT=1
sudo /etc/init.d/dbus start &> /dev/null
# 10. Optional: add user to sudoers
sudo nano /etc/sudoers.d/dbus
# add the below line and uncomment
# your_user_name ALL = (root) NOPASSWD: /etc/init.d/dbus
# Go to no. 11 in `1.windows-steps.ps1`
# 13. Run firefox in the background
firefox &
# 14. Optional: run xfce4 desktop
# Change VcXsrv (in Windows) display settings to "One large window" or "Full screen"
xfce4-session
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment