1.1.9. Windows 10: Windows Subsystem for Linux (WSL)¶
The essential system setup
These setup instructions are for setting up Ubuntu on the “Fall Creators Update” (FCU) version of Windows 10, known as the Windows Subsystem for Linux (WSL). This FCU was released in Windows version 1709 around October, 2017.
See this “What’s New” page for more information about the Windows updates since their earlier beta version of having Ubuntu. Mainly, the present installation is a lot easier now. Yippee.
The user must have admin privileges (can run
sudo ...). Some steps require an internet connection.
- Click here to install WSL, selecting “Ubuntu” as your desired flavor of Linux:
- Click here to start automatic download:Use default installation settings.
Now and forever, first doubleclick on the VcXsrv icon on your Desktop, and then start Ubuntu, for example by typing “ubuntu” in the Windows search bar. (Sorry, not our design!)
To enable copy+paste ability in Ubuntu terminal, right-click on the toolbar at the top of the Ubuntu terminal, and select “Properties”; in the Options tab, make sure the box next to “QuickEdit Mode” is selected.
You can then paste into a terminal by either right-clicking or hitting the “Enter” key. (To “copy” text that is in the terminal, just highlight it, and then you should be able to right-click to paste; to “copy” text from outside the terminal, you probably need to highlight it and hit “Ctrl+c”.)
echo "export DISPLAY=:0.0" >> ~/.bashrc echo "setenv DISPLAY :0.0" >> ~/.cshrc echo "export NO_AT_BRIDGE=1" >> ~/.bashrc echo "setenv NO_AT_BRIDGE 1" >> ~/.cshrc
Purpose: First, set DISPLAY properly, so you can open GUIs like
suma, etc. Then, avoid having some very-non-necessary GTK warnings from programs.
Close (exit) Ubuntu terminal, so that changes are effected the next time you open it.
Install Ubuntu terminal fonts as described HERE.
- The default profile “use colors from system theme” shows an all-black terminal. To fix this:Go to the terminal’s menu bar,Select the
Profile,Turn off “use colors …”, and just pick a scheme+palette that you like.
- Note:In gnome-terminal, things are similar to other Linux implementations. The middle button pastes whatever is highlighted in the WSL terminal or other gnome-terminal:
You can “see” your Windows file system from the Ubuntu side, where it appears as
/mnt/c/. For example, if your Windows username is USERNAME, then the following would copy a file called FILE.pdf on your Windows Desktop to your current Ubuntu terminal location:
cp /mnt/c/Users/USERNAME/Desktop/FILE.pdf .
To mount external devices (e.g., a USB) from the Ubuntu side. Let’s say your external device appears as the “G:” drive on Windows when you plug it into a USB port. You could mount that drive from Ubuntu as follows:
sudo mkdir /mnt/g # make a mount point location; 'g' is a convenient label here sudo mount -t drvfs G: /mnt/g # mount the external drive to it
If you had a file FILE.nii on the “G:” drive USB, you could now copy it to your present location with:
cp /mnt/g/FILE.nii .
To safely unmount the USB before unplugging it, type:
sudo umount /mnt/g
Bonus note: you can mount/unmount network shares in a similar way:
sudo mkdir /mnt/share sudo mount -t drvfs '\\server\share' /mnt/share ... sudo umount /mnt/share
Start a new Ubuntu session. To check your version, copy+paste:
- … Ubuntu 16.04 users, follow the setup instructions through “Make AFNI/SUMA profiles” here:
- … Ubuntu 18.04 users, follow the setup instructions through “Make AFNI/SUMA profiles” here:
Purpose: Complete your life’s ambition to have working AFNI on your Windows computer (though, realize it is Linux that makes this happen!).
AFNI has very minimal Python requirements—at present, matplotlib and numpy. For example, for the recommended automatic QC output from afni_proc.py, matplotlib is necessary.
You can use any method to install+manage Python and its dependencies. But we note that we have found Miniconda to be convenient in managing Python environment(s), and it is replicatable across platforms. If you are interested, you can check out this tutorial, which has both verbose and quick instructions.
But Miniconda is not required.
curl -O https://afni.nimh.nih.gov/pub/dist/edu/data/CD.tgz tar xvzf CD.tgz cd CD tcsh s2.cp.files . ~ cd ..
Purpose: Download the Bootcamp class data; untar+unzip it (= open it up); move into the newly opened directory; execute a script to copy the files to
If no errors occur in the above, and your
afni_system_check.pysays things are OK, you can delete/remove the tarred/zipped package, using “
rm CD.tgz”. If you are really confident, you can also deleted the CD/ directory in the present location.
!Pro tip!: Bring a computer mouse to use at the Bootcamp. It is muuuuch easier to follow the demos that way.
Read+practice with the handy Unix documentation/tutorial.
Purpose: give you a quick lesson/refresher on using basic Linux shell commands (e.g., ls, cd, less, etc.). It will greatly enhance your bootcamp experience– we promise!
Read the “Please Fix” section at the end. If there are no suggestions, then rejoice! Otherwise, try the suggestion(s) there.
Open up the AFNI and SUMA GUIs, juuuust to make sure all is well:
Report any crashes!
If stuck, then …
… put any error message into an online search, and/or post a question on the Message Board
… copy+paste this:
afni_system_check.py -check_all > out.afni_system_check.txt
... and email the file “out.afni_system_check.txt” to an AFNI Guru for advice.
To improve your life when using the terminal, copy+paste:
echo 'set filec' >> ~/.cshrc echo 'set autolist' >> ~/.cshrc echo 'set nobeep' >> ~/.cshrc echo 'alias ls ls --color=auto' >> ~/.cshrc echo 'alias ll ls --color -l' >> ~/.cshrc echo 'alias ltr ls --color -ltr' >> ~/.cshrc echo 'alias ls="ls --color"' >> ~/.bashrc echo 'alias ll="ls --color -l"' >> ~/.bashrc echo 'alias ltr="ls --color -ltr"' >> ~/.bashrc
Purpose: The first commands set up
tcsh(which should already be enabled for
bash, by default). The second set of commands make aliases so that different types of files (“normal” files, zipped files, executables, et al.) and directories are shown using different colors and boldness. It makes it much easier to navigate on a terminal, IMHO.
If you plan to use the FATCAT_matplot functionality in AFNI, then copy+paste the following:
@afni_R_package_install -shiny -circos
Purpose: This script will install the R packages for FATCAT_matplot and other ‘shiny’ tools (via bioconductor). And it might take a little while to complete…
To update your AFNI sometime, copy+paste:
Purpose: This will automatically download the correct, latest AFNI version to your computer, replacing your old binaries. It will also update the
apearchhelp information. Update often!
To check your AFNI version, copy+paste:
Purpose: Report this useful info whenever asking a question on the Message Board!
The record of all changes (new options, new programs, bug fixes, et al.) in AFNI programs is maintained for all to see in the online AFNI History.