Linux, Ubuntu 15.10 and earlier

These setup instructions are for Ubuntu Linux version 20.04 (Focal Fossa). And a note of thanks to Chris Rorden, who contributed advice to these instructions!

Things to note before starting

  1. Each step involves either copy+pasting a command, or clicking on a download link.

  2. Admin privileges are needed for some steps: check if you can run sudo ls, entering the correct password. If you can’t, perhaps ask an administrator to do that step, and you can do the others that don’t require it.

  3. Note your terminal shell type (bash, zsh, tcsh, csh, etc.), by copy+pasting:

    echo $0
  4. Do the system check in the “Evaluate” stage. Try any recommendations in its “Please Fix” section.

  5. If you run into any problems, please just ask a clear question on the AFNI Message Board.

  1. To copy and paste in a Linux terminal, one can use Ctrl+Shift+c and Ctrl+Shift+v, respectively. (In WSL terminals, one might first enable this functionality: rightclick on the panel’s taskbar, select “Properties” and put a checkmark by this option.)

  2. To open a text file, use any text editor you like, and/or you can type gedit FILENAME, such as either:

    gedit ~/.bashrc
    gedit ~/.bashrc &

Install prerequisite packages

  1. To be able to install latest packages, copy+paste:

    sudo apt-get update
  2. For …

    • … versions 15.04 and earlier, copy+paste:

      sudo apt-get install -y tcsh libxp6 xfonts-base python-qt4       \
                              python-matplotlib                        \
                              libmotif4 libmotif-dev motif-clients     \
                              gsl-bin netpbm xvfb gnome-tweak-tool     \
                              libjpeg62 xterm gedit evince firefox eog \


      sudo apt-get update
    • … version 15.10, copy+paste:

      sudo apt-get install -y tcsh xfonts-base python-qt4 gedit evince \
                              python-matplotlib                        \
                              libmotif4 libmotif-dev motif-clients     \
                              gsl-bin netpbm xvfb gnome-tweak-tool     \
                              libjpeg62 firefox eog xfonts-100dpi


      sudo apt-get update


      sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/


      sudo dpkg -i


      sudo apt-get install -f

      (To check your version number, copy+paste: lsb_release -a)

      Purpose: Installs a lot of packages that AFNI depends on (so we don’t have to reinvent the wheel!).

Install AFNI binaries

  1. For …:

    • … (default) installing the binaries from online, copy+paste:

      curl -O
      tcsh @update.afni.binaries -package linux_openmp_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.binaries has also been downloaded, you can skip the curl .. command), copy+paste:

      curl -O
      tcsh @update.afni.binaries -local_package PATH_TO_FILE/linux_openmp_64.tgz -do_extras

    Purpose: Download and unpack the current binaries in your $HOME directory; set the AFNI binary directory name to $HOME/abin/; and add that location to the $PATH in both ~/.cshrc and ~/.bashrc.

Install R

  1. Check your shell type (echo $0). For …

    • … a tcsh terminal, copy+paste:

      setenv R_LIBS $HOME/R
      mkdir  $R_LIBS
      echo  'export R_LIBS=$HOME/R' >> ~/.bashrc
      echo  'setenv R_LIBS ~/R'     >> ~/.cshrc
      curl -O
    • … a bash terminal, copy+paste:

      export R_LIBS=$HOME/R
      mkdir  $R_LIBS
      echo  'setenv R_LIBS ~/R'     >> ~/.cshrc
      echo  'export R_LIBS=$HOME/R' >> ~/.bashrc
      curl -O

    Purpose: Step 1 of setting up modern R from scratch. Set the environment variable $R_LIBS to specify where to install+find the packages. The file obtained using curl contains instructions to add a more uptodate set of R libraries to the source list.

  2. Copy+paste:

    sudo tcsh @add_rcran_ubuntu.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.

  3. Copy+paste:

    rPkgsInstall -pkgs ALL

    Purpose: Get specific R packages needed for AFNI programs. This step might take a while to complete.

Setup Python (opt)

AFNI has very minimal Python requirements—at present, matplotlib and numpy. For example, for the recommended automatic QC output from, matplotlib is necessary.

You can use any method to install+manage Python and its dependencies. In fact, your OS might have all the Python+modules needed to run AFNI already. Check this by running: -check_all

... and seeing there are no notes in the “Please fix” section at the end—if there are none about Python, then you are all set!

But if you do still need to setup Python with appropriate modules, or you want to manage different environments with different package needs (Python or otherwise), then we note that we have found Miniconda to be convenient. It is cross-platform (with occasional OS-specific quirks). If you are interested in either using it or reading more about it, you can check out this tutorial, which has both verbose and quick instructions.

But Miniconda is not required.

Prepare for Bootcamp

  1. Copy+paste:

    curl -O
    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 $HOME/..

    If no errors occur in the above, and your says 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.

  2. !Pro tip!: Bring a computer mouse to use at the Bootcamp. It is muuuuch easier to follow the demos that way.

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

Evaluate setup/system (important!)

  1. Open a new terminal, and then copy+paste: -check_all
  2. Read the “Please Fix” section at the end. If there are no suggestions, then rejoice! Otherwise, try the suggestion(s) there.

  3. Open up the AFNI and SUMA GUIs, juuuust to make sure all is well:


Report any crashes or problems!

If stuck, then …

  • try searching online with the error message, and/or ask on the Message Board

  • send the system check to an AFNI guru for advice—copy+paste: -check_all > out.ASC.txt

    ... and email the file “out.ASC.txt”.

Niceify terminal (optional, but goood)

  1. 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 tab autocompletion for 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.

Keep up-to-date (remember!)

  1. To update your AFNI sometime, copy+paste:

    @update.afni.binaries -d

    That’s it!!

    Purpose: This will automatically download the correct, latest AFNI version to your computer, replacing your old binaries. It will also update the apearch help information. Update often!

  2. To check your AFNI version, copy+paste:

    afni -ver

    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.