Published 2018-08-20.
Last modified 2024-06-06.
Time to read: 2 minutes.
I’ve been using Windows Subsystem for Linux (WSL) headless since it was first released with Windows 10 version 1607 in August 2016. The April 2018 release of Windows 10 (version 1803) significantly improved WSL.
It is possible to work with Ubuntu graphically on a vanilla Windows machine. No special drivers are required. No special Linux or Ubuntu support is required from the computer vendor.
This is my setup for running an X client like
xeyes
or
IntelliJ IDEA from WSL or WSL2,
accessed via a Windows X server like VcXsrv.
These scripts assume Ubuntu 18.04 was installed under WSL.
Essential Scripts
Here are bash scripts to install everything:
Optional Scripts
The remaining scripts are all optional.
VNC
These bash scripts allow VNC to connect to a remote machine or to WSL on the local machine.
Packages and Programming Environments
Installation of various packages and programming environments follow.
Git
Python
NodeJS
Java Virtual Machine
Miscellaneous
Wine
The advent of WSL means that Wine is no longer required!
Configuration
This is my WSL configuration file, in my Windows home directory (%systemdrive%%homepath%\.wslconfig
).
See Advanced settings configuration in WSL for more information.
# See https://docs.microsoft.com/en-us/windows/wsl/wsl-config#configure-global-options-with-wslconfig # See https://github.com/microsoft/WSL/issues/4166 [wsl2] memory=8GB swap=60GB #processor=4 localhostForwarding=true [experimental] autoMemoryReclaim=drop sparseVhd=true
2024-02-20 Update
The WSL v2.1.3 prerelease sets the the default memory reclamation mode to dropcache. The following is now a default setting:wsl2.autoMemoryReclaim=drop
wsl.exe --update --pre-release
Upgrading from Ubuntu 19.11 to Ubuntu 20.04
Update Aug 17, 2020: Here are my notes on upgrading WSL and WSL2 from Ubuntu 19.11 to Ubuntu 20.04.
Run Associated Windows Program
To run the Windows program associated with a file,
preface the file with cmd.exe /C start
.
For example, to run the default Windows video viewer for .mkv
files, type:
$ cmd.exe /C start my_file.mkv
I defined a bash alias to make this easier:
alias run='cmd.exe /C start'
Reload the bash aliases after editing ~/.bash_aliases
:
$ source ~/.bash_aliases
Now use the run
alias to run the default Windows video viewer for .mkv
files like this:
$ run my_file.mkv