Installing on the Windows Subsystem for Linux (WSL)

All code for this document is located here.

Here we will discuss how to get FSL (and other Linux only applications) onto a Windows machine using the Windows Subsystem for Linux (WSL). All of these instructions require Windows 10 or higher. Some of this content was adapted from

Install Linux Subsystem

Information below can be found here (

  1. Enable “Windows Subsystem for Linux” feature using one of the options here
  • Option 1 (easy): Check the appropriate box within “Turn Windows features on or off” dialog box. (Open Settings -> Search “programs” -> Select “Turn Windows features on or off”) Step 1b: You will need to restart your computer, as prompted, after this feature is enabled.
  • Option 1 (faster but harder): Use Command-Line/PowerShell by pasting in the code below
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux 
  1. Download and install your preferred Linux distribution from the Windows Store – Ubuntu is the recommended distribution. There are other options to download from Command-Line/Script or download and manually Unpack/Install.

  2. Open Ubuntu. Here we will set up NeuroDebian using bash, which houses a ton of neuroimaging software:

sudo apt-get update -qq -y
sudo apt-get install -y wget git
OS_DISTRIBUTION=$(lsb_release -cs)
wget -O-${OS_DISTRIBUTION}.us-nh.full | sudo tee /etc/apt/sources.list.d/neurodebian.sources.list
sudo apt-key adv --recv-keys --keyserver hkp:// 0xA5D32F012649A5A9
sudo apt-get update
  1. Install FSL:
sudo apt-get install fsl
  1. Run these following commands:
echo ". /etc/fsl/" >> ~/.bashrc
echo "export DISPLAY=localhost:0.0" >> ~/.bashrc

This will set up the FSL environment whenever you have bash opened up in a new window. Also, this will allow FSL to open displays on the machine.

Getting Windows to Pop up

  1. In Linux, Install x11 apps (
sudo apt-get install x11-apps
  1. Start Xming (or other x11 app) on the Windows side.

Setting up R

  1. Install R with OpenBLAS capabilities:
sudo apt-get install libopenblas-base r-base
  1. Install RStudio Server. Check to make sure this is the most up-to-date version:
export RSTUDIO_VERSION=$(wget --no-check-certificate -qO-
sudo wget -q${RSTUDIO_VERSION}-amd64.deb
sudo gdebi --non-interactive rstudio-server-${RSTUDIO_VERSION}-amd64.deb
sudo rm rstudio-server-*-amd64.deb 
  1. On the Windows side, navigate on a browser (e.g. Chrome) to https://localhost:8787, which should give you a login screen. Use the login information for the Ubuntu machine to use RStudio (with the Linux backend) on the Windows machine!

Installing Packages in R

  1. Install the requirements for the dependencies for devtools:
sudo apt-get update -qq -y
sudo apt-get install -y libgit2-dev 
sudo apt-get install -y libcurl4-openssl-dev libssl-dev
sudo apt-get install -y zlib1g-dev libssh2-1-dev libpq-dev libxml2-dev 
sudo apt-get install -y libhdf5
  1. In the RStudio server or R. Install devtools and fslr:
install.packages("devtools", repos = "")

Check this installation by trying to run some help file, such as:
  1. In the RStudio server or R. Install devtools and fslr:

Session Info