Differences between revisions 7 and 8
Deletions are marked like this. Additions are marked like this.
Line 182: Line 182:
'''''... then modify your DISPLAY variable as follows ...'''''

<<BR>>developer@DESKTOP-LD48TB7:~$ export DISPLAY="`grep nameserver /etc/resolv.conf | sed 's/nameserver //'`:0"

'''''... and edit the file C:\Program Files (x86)\Xming\X0.hosts to contain your IP address above the entrry for localhost ...'''''
'''''... then modify your DISPLAY variable to contain your IP address before the :0 ...'''''

<<BR>>developer@DESKTOP-LD48TB7:~$ grep nameserver /etc/resolv.conf
<<BR>>developer@DESKTOP-LD48TB7:~$ export DISPLAY=""

'''''... edit the Xming X0.hosts file from the windows side to contain your IP address above the entry for localhost ...'''''
'''''... before edit ...'''''
<<BR>>developer@DESKTOP-LD48TB7:~$ cat /mnt/c/"Program Files (x86)"/Xming/X0.hosts
<<BR>>'''''... after edit ...'''''
<<BR>>developer@DESKTOP-LD48TB7:~$ cat /mnt/c/"Program Files (x86)"/Xming/X0.hosts
<<BR>>'''''... check DISPLAY matches IP address...'''''
<<BR>>developer@DESKTOP-LD48TB7:~$ echo $DISPLAY

'''''... try running freeview again ...'''''

<<BR>>developer@DESKTOP-LD48TB7:~$ freeview

Freesurfer install on Ubuntu 18 running in WSL

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.

After Ubuntu 18 was installed via the MS WSl instructions, 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 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.

... 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 ...

developer@DESKTOP-LD48TB7:~$ wget https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/dev/freesurfer_7-dev_amd64.deb
--2021-05-20 04:56:12-- https://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/dev/freesurfer_7-dev_amd64.deb
Resolving surfer.nmr.mgh.harvard.edu (surfer.nmr.mgh.harvard.edu)...
Connecting to surfer.nmr.mgh.harvard.edu (surfer.nmr.mgh.harvard.edu)||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3528163516 (3.3G) [application/vnd.debian.binary-package]
Saving to: ‘freesurfer_7-dev_amd64.deb’

freesurfer_7-dev_amd64.deb 100%[==================================================================================>] 3.29G 31.3MB/s in 1m 50s

2021-05-20 04:58:02 (30.7 MB/s) - ‘freesurfer_7-dev_amd64.deb’ saved [3528163516/3528163516]

developer@DESKTOP-LD48TB7:~$ ls

... update the repo information on the machine to index the latest packages ...

developer@DESKTOP-LD48TB7:~$ sudo apt-get update
[sudo] password for developer:
Get:1 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:4 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [1726 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:6 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [322 kB]
Get:7 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages [323 kB]
Get:8 http://security.ubuntu.com/ubuntu bionic-security/restricted Translation-en [43.2 kB]
Get:9 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [1126 kB]
Get:10 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [254 kB]
Get:11 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages [19.2 kB]
Get:12 http://security.ubuntu.com/ubuntu bionic-security/multiverse Translation-en [4412 B]
Get:13 http://archive.ubuntu.com/ubuntu bionic/universe amd64 Packages [8570 kB]
Get:14 http://archive.ubuntu.com/ubuntu bionic/universe Translation-en [4941 kB]
Get:15 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 Packages [151 kB]
Get:16 http://archive.ubuntu.com/ubuntu bionic/multiverse Translation-en [108 kB]
Get:17 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [2070 kB]
Get:18 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [413 kB]
Get:19 http://archive.ubuntu.com/ubuntu bionic-updates/restricted amd64 Packages [344 kB]
Get:20 http://archive.ubuntu.com/ubuntu bionic-updates/restricted Translation-en [46.8 kB]
Get:21 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1735 kB]
Get:22 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [369 kB]
Get:23 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse amd64 Packages [25.0 kB]
Get:24 http://archive.ubuntu.com/ubuntu bionic-updates/multiverse Translation-en [6464 B]
Get:25 http://archive.ubuntu.com/ubuntu bionic-backports/main amd64 Packages [10.0 kB]
Get:26 http://archive.ubuntu.com/ubuntu bionic-backports/main Translation-en [4764 B]
Get:27 http://archive.ubuntu.com/ubuntu bionic-backports/universe amd64 Packages [10.3 kB]
Get:28 http://archive.ubuntu.com/ubuntu bionic-backports/universe Translation-en [4588 B]
Fetched 22.9 MB in 27s (857 kB/s)
Reading package lists... Done

... 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 ...

developer@DESKTOP-LD48TB7:~$ sudo apt-get install ./freesurfer_7-dev_amd64.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'freesurfer' instead of './freesurfer_7-dev_amd64.deb'
The following additional packages will be installed:
csh libglu1-mesa libgomp1 libjpeg62 libxss1 make tcsh
Suggested packages:
The following NEW packages will be installed:
csh freesurfer libglu1-mesa libgomp1 libjpeg62 libxss1 make tcsh
0 upgraded, 8 newly installed, 0 to remove and 148 not upgraded.
Need to get 1156 kB/3529 MB of archives.
After this operation, 3034 kB of additional disk space will be used.

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

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

... 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
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
developer@DESKTOP-LD48TB7:~$ export DISPLAY=""

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

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

... try running freeview again ...

developer@DESKTOP-LD48TB7:~$ freeview

FS7_wsl_ubuntu (last edited 2021-06-03 00:47:46 by buildqa)