Windows + Linux = 💕
Setting up the WSL2 machine
You must be running Windows 10 version 2004 and higher (Build 19041 and higher) or Windows 11.
You can install everything you need to run Windows Subsystem for Linux (WSL) by entering this command in an administrator PowerShell or Windows Command Prompt and then restarting your machine.
|
|
This command will enable the required optional components, download the latest Linux kernel, set WSL 2 as your default, and install a Linux distribution for you (Ubuntu by default). 1
If any issues appear, please refer to Microsoft’s guide.
Installing some packages
After your reboot, you should be able to open a terminal and type wsl to enter the Linux environment. Go ahead and do this, since we want to install some packages.
Update
The first thing we want to do is update the package repository, do this with the following command:
|
|
x11-apps (for testing)
The next thing we want to install is x11-apps, this is mainly for testing the X-Server later, but it will save you a headache, trust me. 😅
|
|
OpenGL
And the final thing we need to get Gloss library running later on is GLUT, the best version of this we can get on Ubuntu would be FreeGLUT3, which should be included in the universal repository. We will also install all of the required OpenGL libraries.
|
|
Configuring the X11 server
Windows configuration
The next step is to install an X-Server, my recommendation is VcXsrv, it’s very simple to install and should only take you a few minutes.
Run the shortcut that appears on your desktop and set the options to:
- Multiple Windows
- Start no client
- DISABLE Native OpenGL
- ENABLE Disable access control
Press the save config option, and put it somewhere nice. You can even put this in your startup folder in order to have it run on startup.
Linux configuration
Navigate to your home directory cd ~ and open your .bashrc file in a text editor.
Add this to the bottom of it:
|
|
Verifying the X11 Server
Verify in your system tray that the X-Server is running in the background, and try typing in xcalc in your WSL terminal, a window should pop up in Windows 10.
Another way to verify that the X-Server is running is by running the netstat command. Open an elevated prompt (admin) and run the following command.
|
|
which returns a table
|
|
If you see something like this, it is indeed working.
Haskell + Gloss = λ
aptitude (recommended)
Installing cabal and ghc is very easy on Ubuntu, you can simply apt-get it!
|
|
Now run a quick cabal update and then cabal install gloss.
Open up ghci and type the following commands.
|
|
|
|
If you see this window…

… you’re done! 🎉
If not, well, some annoying troubleshooting is ahead my friend. Check out the Verifying the X11 Server section, and try opening port 6000 inbound in your firewall.
If all else fails, contact me if you know me, or leave a comment down below!
-
This is excerpted from Microsoft’s guide to installing WSL. ↩︎