Differences between revisions 12 and 13
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
=== Freesurfer install on Ubuntu 18 running in WSL === === Freesurfer install on Ubuntu Linux in WSL ===
Line 3: Line 3:
The terminal session below shows how to download, install and setup the freesurfer and X-windows environment using a terminal window launched from Ubuntu 18 running in WSL under Windows 10. The free version of Ubuntu 18 was selected from the Windows store. Please read the latest MS documentation about how to setup WSL (version2 as of this writing) on your Windows machine, [[https://docs.microsoft.com/en-us/windows/wsl/install-win10|MS WSL Dcoumentation]]. Once you are able to bring up a terminal window in WSL's pre-installed version of Ubuntu linux you can proceed to setting up the Freesurfer environment. As of this writing, WSL should install Ubuntu 22 Linux and so the install of a Freesurfer Ubuntu 22 package is listed below.
Line 5: Line 5:
After Ubuntu 18 was installed via the MS WSl instructions, [[https://docs.microsoft.com/en-us/windows/wsl/install-win10|MS Dcoumentation for WSL version 2 setup and install]] then subsequently the repos were updated on Ubuntu 18, the freesurfer installer was downloaded/installed and the shell environment was setup to run X graphics and freesurfer. The commands below shows how to download and install the freesurfer package. That is followed by notes on setting up a 3rd party X-windows server on the host Windows machine using Xming. If you do not need to view any brain images, e.g., through Freeview, then there is no need to setup the X-Windows server.
Line 7: Line 7:
The freesurfer. *.deb package should work on Ubuntu 18 and 20, but as of this writing it has not been tested on newer versions of Ubuntu linux. We do not advise manually trying to install packages in order to get freesurfer to run. Please allow the installer to try and determine what packages are needed on the system and install them. We do not advise manually trying to install packages in the Ubuntu Linux image in order to get freesurfer to run. Please allow the installer to try and determine what packages are needed on the system and install them.
Line 9: Line 9:
'''''... download the appropriate Freesurfer *.deb installer package. This is the dev stream
installer package. For an actual release like 7.2.0, you would look for the package under the URL https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.2.0 ...'''''
Line 12: Line 10:
<<BR>>developer@DESKTOP-LD48TB7:~$
'''wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/dev/freesurfer_7-dev_amd64.deb'''
<<BR>>--2021-05-20 04:56:12-- https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/dev/freesurfer_7-dev_amd64.deb
<<BR>>Resolving surfer.nmr.mgh.harvard.edu (surfer.nmr.mgh.harvard.edu)... 132.183.240.105
<<BR>>Connecting to surfer.nmr.mgh.harvard.edu (surfer.nmr.mgh.harvard.edu)|132.183.240.105|:443... connected.
<<BR>>HTTP request sent, awaiting response... 200 OK
<<BR>>Length: 3528163516 (3.3G) [application/vnd.debian.binary-package]
<<BR>>Saving to: ‘freesurfer_7-dev_amd64.deb’
developer@DESKTOP-LD48TB7:~$ '''cd'''
<<BR>><<BR>>
developer@DESKTOP-LD48TB7:~$ '''wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer_ubuntu22-7.4.1_amd64.deb'''
Line 21: Line 14:
<<BR>>freesurfer_7-dev_amd64.deb 100%[==================================================================================>] 3.29G 31.3MB/s in 1m 50s ... download output ...
<<BR>><<BR>>
developer@DESKTOP-LD48TB7:~$ '''ls freesurfer_ubuntu22-7.4.1_amd64.deb'''
Line 23: Line 18:
<<BR>>2021-05-20 04:58:02 (30.7 MB/s) - ‘freesurfer_7-dev_amd64.deb’ saved [3528163516/3528163516] freesurfer_ubuntu22-7.4.1_amd64.deb
<<BR>><<BR>>
... update the package information in Ubuntu linux ...

developer@DESKTOP-LD48TB7:~$ '''sudo apt-get update -y'''
Line 25: Line 24:
<<BR>>developer@DESKTOP-LD48TB7:~$
'''ls'''
<<BR>>freesurfer_7-dev_amd64.deb
[sudo] password for developer:
<<BR>>
... output from package updates ...
<<BR>>
Line 29: Line 29:
'''''... update the repo information on the machine to index the latest packages ...''''' ... install the freesurfer distribution under /usr/local/freesurfer/<release>. Anwer "Y" to any prompts ...
Line 31: Line 31:
<<BR>>developer@DESKTOP-LD48TB7:~$
'''sudo apt-get update'''
<<BR>>[sudo] password for developer:
<<BR>>Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
<<BR>>Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
<<BR>>Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
<<BR>>Get:4 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [1726 kB]
<<BR>>Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
<<BR>>Get:6 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [322 kB]
<<BR>>Get:7 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [323 kB]
<<BR>>Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted Translation-en [43.2 kB]
<<BR>>Get:9 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1126 kB]
<<BR>>Get:10 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [254 kB]
<<BR>>Get:11 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [19.2 kB]
<<BR>>Get:12 http://security.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [4412 B]
<<BR>>Get:13 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8570 kB]
<<BR>>Get:14 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4941 kB]
<<BR>>Get:15 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
<<BR>>Get:16 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB]
<<BR>>Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [2070 kB]
<<BR>>Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [413 kB]
<<BR>>Get:19 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [344 kB]
<<BR>>Get:20 http://archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [46.8 kB]
<<BR>>Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1735 kB]
<<BR>>Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [369 kB]
<<BR>>Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [25.0 kB]
<<BR>>Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [6464 B]
<<BR>>Get:25 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [10.0 kB]
<<BR>>Get:26 http://archive.ubuntu.com/ubuntu bionic-backports/main Translation-en [4764 B]
<<BR>>Get:27 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [10.3 kB]
<<BR>>Get:28 http://archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [4588 B]
<<BR>>Fetched 22.9 MB in 27s (857 kB/s)
<<BR>>Reading package lists... Done
developer@DESKTOP-LD48TB7:~$ '''sudo apt-get -y install ./freesurfer_ubuntu22-7.4.1_amd64.deb'''
<<BR>>
[sudo] password for developer:
<<BR>>
The following NEW packages will be installed:
<<BR>>
... output from package updates followed by install of freesurfer package ...
Line 65: Line 39:
'''''... run the apt get/install command to automatically install the freesurfer distribution under
/usr/local/freesurfer/<release>. Answer "Y" so any package dependenices can be installed.
The packages installed on your system may vary depending upon what is already installed on
your system ...'''''
Line 70: Line 40:
<<BR>>developer@DESKTOP-LD48TB7:~$
'''sudo apt-get install ./freesurfer_7-dev_amd64.deb'''
<<BR>>Reading package lists... Done
<<BR>>Building dependency tree
<<BR>>Reading state information... Done
<<BR>>Note, selecting 'freesurfer' instead of './freesurfer_7-dev_amd64.deb'
<<BR>>The following additional packages will be installed:
<<BR>> csh libglu1-mesa libgomp1 libjpeg62 libxss1 make tcsh
<<BR>>Suggested packages:
<<BR>> make-doc
<<BR>>The following NEW packages will be installed:
<<BR>> csh freesurfer libglu1-mesa libgomp1 libjpeg62 libxss1 make tcsh
<<BR>>0 upgraded, 8 newly installed, 0 to remove and 148 not upgraded.
<<BR>>Need to get 1156 kB/3529 MB of archives.
<<BR>>After this operation, 3034 kB of additional disk space will be used.

'''Do you want to continue? [Y/n] Y'''

<<BR>>Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxss1 amd64 1:1.2.2-1 [8582 B]
<<BR>>Get:2 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 csh amd64 20110502-3ubuntu0.18.04.1 [243 kB]
<<BR>>Get:3 http://archive.ubuntu.com/ubuntu bionic/main amd64 make amd64 4.1-9.1ubuntu1 [154 kB]
<<BR>>Get:4 http://archive.ubuntu.com/ubuntu bionic/universe amd64 tcsh amd64 6.20.00-7 [428 kB]
<<BR>>Get:5 http://archive.ubuntu.com/ubuntu bionic/main amd64 libglu1-mesa amd64 9.0.0-2.1build1 [168 kB]
<<BR>>Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgomp1 amd64 8.4.0-1ubuntu1~18.04 [76.5 kB]
<<BR>>Get:7 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libjpeg62 amd64 1:6b2-3 [78.3 kB]
<<BR>>Get:8 /home/developer/freesurfer_7-dev_amd64.deb freesurfer amd64 7-dev [3528 MB]
<<BR>>Fetched 1156 kB in 40s (28.8 kB/s)
<<BR>>Selecting previously unselected package libxss1:amd64.
<<BR>>(Reading database ... 29293 files and directories currently installed.)
<<BR>>Preparing to unpack .../0-libxss1_1%3a1.2.2-1_amd64.deb ...
<<BR>>Unpacking libxss1:amd64 (1:1.2.2-1) ...
<<BR>>Selecting previously unselected package csh.
<<BR>>Preparing to unpack .../1-csh_20110502-3ubuntu0.18.04.1_amd64.deb ...
<<BR>>Unpacking csh (20110502-3ubuntu0.18.04.1) ...
<<BR>>Selecting previously unselected package make.
<<BR>>Preparing to unpack .../2-make_4.1-9.1ubuntu1_amd64.deb ...
<<BR>>Unpacking make (4.1-9.1ubuntu1) ...
<<BR>>Selecting previously unselected package tcsh.
<<BR>>Preparing to unpack .../3-tcsh_6.20.00-7_amd64.deb ...
<<BR>>Unpacking tcsh (6.20.00-7) ...
<<BR>>Selecting previously unselected package libglu1-mesa:amd64.
<<BR>>Preparing to unpack .../4-libglu1-mesa_9.0.0-2.1build1_amd64.deb ...
<<BR>>Unpacking libglu1-mesa:amd64 (9.0.0-2.1build1) ...
<<BR>>Selecting previously unselected package libgomp1:amd64.
<<BR>>Preparing to unpack .../5-libgomp1_8.4.0-1ubuntu1~18.04_amd64.deb ...
<<BR>>Unpacking libgomp1:amd64 (8.4.0-1ubuntu1~18.04) ...
<<BR>>Selecting previously unselected package libjpeg62:amd64.
<<BR>>Preparing to unpack .../6-libjpeg62_1%3a6b2-3_amd64.deb ...
<<BR>>Unpacking libjpeg62:amd64 (1:6b2-3) ...
<<BR>>Selecting previously unselected package freesurfer.
<<BR>>Preparing to unpack .../7-freesurfer_7-dev_amd64.deb ...
<<BR>>Unpacking freesurfer (7-dev) ...
<<BR>>Setting up libgomp1:amd64 (8.4.0-1ubuntu1~18.04) ...
<<BR>>Setting up make (4.1-9.1ubuntu1) ...
<<BR>>Setting up libjpeg62:amd64 (1:6b2-3) ...
<<BR>>Setting up libxss1:amd64 (1:1.2.2-1) ...
<<BR>>Setting up tcsh (6.20.00-7) ...
<<BR>>update-alternatives: using /bin/tcsh to provide /bin/csh (csh) in auto mode
<<BR>>Setting up libglu1-mesa:amd64 (9.0.0-2.1build1) ...
<<BR>>Setting up csh (20110502-3ubuntu0.18.04.1) ...
<<BR>>update-alternatives: using /bin/bsd-csh to provide /bin/csh (csh) in auto mode
<<BR>>Setting up freesurfer (7-dev) ...
<<BR>>Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
<<BR>>Processing triggers for libc-bin (2.27-3ubuntu1.2) ...

Freesurfer install on Ubuntu Linux in WSL

Please read the latest MS documentation about how to setup WSL (version2 as of this writing) on your Windows machine, MS WSL Dcoumentation. Once you are able to bring up a terminal window in WSL's pre-installed version of Ubuntu linux you can proceed to setting up the Freesurfer environment. As of this writing, WSL should install Ubuntu 22 Linux and so the install of a Freesurfer Ubuntu 22 package is listed below.

The commands below shows how to download and install the freesurfer package. That is followed by notes on setting up a 3rd party X-windows server on the host Windows machine using Xming. If you do not need to view any brain images, e.g., through Freeview, then there is no need to setup the X-Windows server.

We do not advise manually trying to install packages in the Ubuntu Linux image in order to get freesurfer to run. Please allow the installer to try and determine what packages are needed on the system and install them.

developer@DESKTOP-LD48TB7:~$ cd

developer@DESKTOP-LD48TB7:~$ wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/7.4.1/freesurfer_ubuntu22-7.4.1_amd64.deb
... download output ...

developer@DESKTOP-LD48TB7:~$ ls freesurfer_ubuntu22-7.4.1_amd64.deb
freesurfer_ubuntu22-7.4.1_amd64.deb

... update the package information in Ubuntu linux ...

developer@DESKTOP-LD48TB7:~$ sudo apt-get update -y
[sudo] password for developer:
... output from package updates ...

... install the freesurfer distribution under /usr/local/freesurfer/<release>. Anwer "Y" to any prompts ...

developer@DESKTOP-LD48TB7:~$ sudo apt-get -y install ./freesurfer_ubuntu22-7.4.1_amd64.deb
[sudo] password for developer:
The following NEW packages will be installed:
... output from package updates followed by install of freesurfer package ...

... the development stream package is installed under /usr/local/freesurfer/7-dev. The 7.2.0 release install would be under /usr/local/freesurfer/7.2.0 There is no conflict with having multiple versions of freesufer installed under parallel subdirectories - you only need to change the setting of the FREESURFER_HOME environment variable ...


developer@DESKTOP-LD48TB7:~$ ls /usr/local/freesurfer/7-dev/
ASegStatsLUT.txt FreeSurferEnv.sh Simple_surface_labels2009.txt build-stamp.txt fsafd mni sources.csh tktools
DefectLUT.txt SegmentNoLUT.txt WMParcStatsLUT.txt diffusion fsfast models sources.sh trctrain
FreeSurferColorLUT.txt SetUpFreeSurfer.csh average docs lib python subjects
FreeSurferEnv.csh SetUpFreeSurfer.sh bin etc matlab sessions tkmeditParcColorsCMA

... setup your shell with the necessary environment variables for X-windows graphics and freesurfer. You can add these directly to your shell init file, e.g., the .bashrc file for bash shell. You will also need a license file for freesurfer which can be pointed to by an environment variable ...


developer@DESKTOP-LD48TB7:~$ echo "export XDG_RUNTIME_DIR=$HOME/.xdg" >> $HOME/.bashrc
developer@DESKTOP-LD48TB7:~$ echo "export DISPLAY=:0" >> $HOME/.bashrc
developer@DESKTOP-LD48TB7:~$ echo "export FREESURFER_HOME=/usr/local/freesurfer/7-dev" >> $HOME/.bashrc

... Add your license file and set FS_LICENSE to point to it ...


developer@DESKTOP-LD48TB7:~$ echo "export FS_LICENSE=$HOME/license.txt" >> $HOME/.bashrc
developer@DESKTOP-LD48TB7:~$ echo "source /usr/local/freesurfer/7-dev/SetUpFreeSurfer.sh" >> $HOME/.bashrc

... logout and log back in and verify you see the following ...


- - - - - - - -freesurfer-linux-ubuntu18_x86_64-dev-20210518-60f02e6- - - - - - - -
Setting up environment for FreeSurfer/FS-FAST (and FSL)
FREESURFER_HOME /usr/local/freesurfer/7-dev/
FSFAST_HOME /usr/local/freesurfer/7-dev//fsfast
FSF_OUTPUT_FORMAT nii.gz
SUBJECTS_DIR /usr/local/freesurfer/7-dev//subjects
INFO: /home/developer/matlab/startup.m does not exist ... creating
MNI_DIR /usr/local/freesurfer/7-dev//mni

... you should now be able to run freeview and other commands from the distribution pointed to by $FREESURFER_HOME/bin. Please note that if you see the following error when trying to run freeview ...


developer@DESKTOP-LD48TB7:~$ freeview
QXcbConnection: Could not connect to display :0
Could not connect to any X display.

... then modify your DISPLAY variable to contain your IP address before the :0 ...


developer@DESKTOP-LD48TB7:~$ grep nameserver /etc/resolv.conf
nameserver 154.132.1.1
developer@DESKTOP-LD48TB7:~$ export DISPLAY="154.132.1.1:0"

... edit the Xming X0.hosts file from the windows side to contain your IP address BELOW the entry for localhost ...

... before edit ...
developer@DESKTOP-LD48TB7:~$ cat /mnt/c/"Program Files (x86)"/Xming/X0.hosts
localhost
... after edit ...
developer@DESKTOP-LD48TB7:~$ cat /mnt/c/"Program Files (x86)"/Xming/X0.hosts
localhost
154.132.1.1
... check DISPLAY matches IP address...
developer@DESKTOP-LD48TB7:~$ echo $DISPLAY
154.132.1.1:0

... try running freeview again ...


developer@DESKTOP-LD48TB7:~$ freeview

FS7_wsl_ubuntu (last edited 2023-09-05 03:07:34 by buildqa)