Skip to content

Instantly share code, notes, and snippets.

@markstachowski
Forked from BusterNeece/00-setup.md
Created April 28, 2022 18:54
Show Gist options
  • Save markstachowski/3782c50effecd390c638b7647512a4f7 to your computer and use it in GitHub Desktop.
Save markstachowski/3782c50effecd390c638b7647512a4f7 to your computer and use it in GitHub Desktop.
My WSL2 Ubuntu 20.04 Environment

My local Ubuntu 20.04 WSL2 setup.

Enable and Install WSL2

From Windows, as admin:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Install the latest WSL2 kernel.

Restart, then:

wsl --set-default-version 2

Set up X410 Settings

  • Install X410 from Windows Store
  • Launch X410
  • Right click tray menu, click "Allow Public Access", then allow through Windows Firewall

Set up Ubuntu 20.04

Initial setup inside Ubuntu Bash:

sudo apt-get update
sudo apt-get upgrade

# Installing common deps
sudo apt-get install git gpg vim tasksel

# Set up desktop environment
sudo tasksel

# Select "Ubuntu minimal desktop" in tasksel.

# Install the Dotnet Core framework repository
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

# Install Genie (for creating a pseudo-systemd-compatible environment to run in)
curl -s https://packagecloud.io/install/repositories/arkane-systems/wsl-translinux/script.deb.sh | sudo bash

sudo apt install -y systemd-genie
  • Create file desktop.sh in user root (below).
  • chmod a+x desktop.sh

Launching

  • Create a file launch-desktop.bat somewhere on the host OS (perhaps Desktop); contents listed below.
  • Run the batch script to start up.

Shutting Down

Shut down the WSL2 instance by running:

wsl -t Ubuntu-20.04
#!/bin/bash
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0.0;
export XDG_SESSION_TYPE="x11"
export XDG_RUNTIME_DIR=~/xdg
export XDG_SESSION_CLASS="user"
export XDG_SESSION_DESKTOP=ubuntu
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
export DESKTOP_SESSION=ubuntu
export GDMSESSION=ubuntu
gnome-session
start /B x410.exe /desktop
ubuntu2004.exe run "genie -c ~/desktop.sh"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment