1.1.4. Linux, Ubuntu 18.04¶
The essential system setup
These setup instructions are for Ubuntu Linux version 18.04 (Bionic Beaver). And a note of thanks to Kiyotaka and other AFNI users who contributed advice to these instructions on the MB!
Each step involves either copy+pasting a command, or clicking on a download link.
The user must have admin privileges (can run
sudo ...). Some steps require an internet connection.
Is your terminal shell
tcsh(or other)? To find out, type:
Do the system check in the “Evaluate” stage. Try any recommendations in its “Please Fix” section.
If you run into any problems, please just ask a clear question on the Message Board.
To open a text file, you can type
gedit FILENAME. For example, to open the bash “rc” file:
gedit ~/.bashrc &
sudo add-apt-repository universe
sudo apt-get update sudo apt-get install -y tcsh xfonts-base python-qt4 \ python-matplotlib \ gsl-bin netpbm gnome-tweak-tool \ libjpeg62 xvfb xterm vim curl \ gedit evince eog \ libglu1-mesa-dev libglw1-mesa \ libxm4 build-essential \ libcurl4-openssl-dev libxml2-dev \ libssl-dev libgfortran3 \ gnome-terminal nautilus \ gnome-icon-theme-symbolic \ firefox xfonts-100dpi
Purpose: Installs a lot of packages that AFNI depends on (so we don’t have to reinvent the wheel!). This may take a little while to complete running.
Some of these packages also improve terminal behavior, especially if you are running Ubuntu on a Windows machine.
sudo ln -s /usr/lib/x86_64-linux-gnu/libgsl.so.23 /usr/lib/x86_64-linux-gnu/libgsl.so.19
Purpose: Make a symbolic link for the specific version of GSL included in this version of Ubuntu.
… (default) installing the binaries from online, copy+paste:
cd curl -O https://email@example.com tcsh @update.afni.binaries -package linux_ubuntu_16_64 -do_extras
… (alternative) installing already-downloaded binaries, you can use
-local_package ..(replace “PATH_TO_FILE” with the actual path; also, if
@update.afni.binarieshas also been downloaded, you can skip the
curl ..command), copy+paste:
cd curl -O https://firstname.lastname@example.org tcsh @update.afni.binaries -local_package PATH_TO_FILE/linux_ubuntu_16_64.tgz -do_extras
Purpose: Download and unpack the current binaries in your
$HOMEdirectory; set the AFNI binary directory name to
$HOME/abin/; and add that location to the
cp $HOME/abin/AFNI.afnirc $HOME/.afnirc suma -update_env
Purpose: Set up vanilla-mode environment variables for AFNI and SUMA. To see how you can bend these to your will later, read the Technical notes.
setenv R_LIBS $HOME/R mkdir $R_LIBS echo 'export R_LIBS=$HOME/R' >> ~/.bashrc echo 'setenv R_LIBS ~/R' >> ~/.cshrc curl -O https://afni.nimh.nih.gov/pub/dist/src/scripts_src/@add_rcran_ubuntu_18.04.tcsh
export R_LIBS=$HOME/R mkdir $R_LIBS echo 'setenv R_LIBS ~/R' >> ~/.cshrc echo 'export R_LIBS=$HOME/R' >> ~/.bashrc curl -O https://afni.nimh.nih.gov/pub/dist/src/scripts_src/@add_rcran_ubuntu_18.04.tcsh
(To check your shell type, copy+paste:
Purpose: Step 1 of setting up modern R from scratch. Set the environment variable
$R_LIBSto specify where to install+find the packages. The file obtained using
curlcontains instructions to add a more uptodate set of R libraries to the source list.
sudo tcsh @add_rcran_ubuntu_18.04.tcsh
Purpose: This script updates your package manager to be able to get a modern version of R. If you don’t already have R on your system, it will install it. If you do have R, it will stop and ask if you want to remove it and update it, or not.
rPkgsInstall -pkgs ALL
Purpose: Get specific R packages needed for AFNI programs. This step might take a while (of order an hour) to complete, because R will compile the packages. Sigh.
If you are using Windows Subsystem Linux (WSL), and/or if your ‘brms’ package fails to install (as checked in the “Evaluation” step below), then consider to copy+paste:
sudo add-apt-repository -y "ppa:marutter/rrutter3.5" sudo add-apt-repository -y "ppa:marutter/c2d4u3.5" sudo apt update sudo apt install -y r-cran-rstan r-cran-shinystan r-cran-brms
Purpose: Add a couple new repos from which to pull packages, and then get the desired R packages; these steps come mainly from this helpful website.
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.
Also, consider running
Focus Modefrom ‘click’ to ‘mouse’.
Also, consider extending time for screen saver:
Brightness & Lock, and set inactivity duration.
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.