Windows Subsystem for Linux Install & Setup

The Windows Subsystem for Linux (WSL) enables a Linux distribution to run in a "virtualized" environment under Windows OS without utilizing a VM host application such as VirtualBox. Common Linux distributions such as Ubuntu, CentOS and Fedora are available from the Windows App store for download and use in WSL; some like Ubuntu Linux are free.

WSL is primarily intended to give Windows developers a way to test their applications with Linux based services but not reproduce a complete X-Windows based Linux GUI/desktop environment such as Gnome or KDE (which you see on your linux workstation). For Linux running inside WSL on windows, the desktop and terminal window will look like what you see for the default desktop and terminal settings for that particular linux distribution.

WSL includes access to your home directory on the Windows side via NTFS. So if your Windows username was "bill" then from the WSL linux terminal window you can see bill's download folder as the linux path /mnt/c/Users/bill/Downloads in your default shell, e.g., bash, tcsh. This mount point is a convenient way to share files between your Windows home directory and Linux running in WSL. The username you pick when you setup the WSL environment has sudo/admin privileges in the linux environment and need not be the same as your username on the Windows side.

Steps for Setting Up WSL to run freesurfer:

  1. Enable WSL on the windows machine +
  2. Install WSL on the windows machine +
  3. Download/install a linux distribution into WSL ++
  4. Download/install an X-server on the windows machine +++
  5. From a terminal window running inside the linux distribution, download and install freesurfer ++++

+ These steps may be combined into a single command for WSL version 2; see the link to the MS documentation. Your windows machine will be updated and re-booted.

++ For a linux distribution we recommend Ubuntu 22.

+++ An example of installing the Xming X-server is listed below. These steps may vary depending upon the network settings on the Windows machine. Please check that you have given Xming permission to connect through the Firewall using Windows Defender.

++++ We recommend using the freesurfer installer packages, i.e., the *.deb file for Ubuntu linux.

Setup and Install WSL version 2

As of this writing, WSL version 2 is available. If no version of WSL is currently installed on your Windows machine, then follow the MS documentation to install WSL version 2,

Freesurfer WSL2

Previous instructions for the manual setup and install of WSL version 1 (skip if using WSL version 2), Enable WSL version 1 from PowerShell

Install and Run an X-Server in Windows

Install X-server (Xming)

Install and Run a Linux OS in WSL - Install and Run Freesurfer in Linux

Example OS's running under WSL and installing freesurfer on them:

WSL_Ubuntu_freesurfer

WSL_CentOS_freesurfer

You can choose a freesurfer distribution to install from the following links:

Freesurfer releases have gone through testing for recon-all and freeview. We recommend installing the latest release unless you have some work in progress that requires installing an older release.

Development stream builds contain ongoing development work and code changes that are the basis for future freesurfer releases. The development stream packages have not gone through the same testing and Q/A for stability as an actual freesurfer release.