1.1.3. Linux, Ubuntu 16.04 - 17.10

What to do?

These setup instructions are for Ubuntu Linux versions 16.04 (Xenial Xerus) through 17.10 (Artful Aardvark).

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

  2. The user must have admin privileges (can run sudo ...). Some steps require an internet connection.

  3. Is your terminal shell bash or tcsh (or other)? To find out, type:

    echo $0
    
  4. Don’t forget the system check in the “Evaluate” stage. Try whatever the is recommended in its “Please Fix” section.

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

  6. To open a text file, you can type gedit FILENAME. For example, to open the bash “rc” file:

    gedit ~/.bashrc &
    

Install prerequisite packages

  1. Copy+paste:

    sudo add-apt-repository universe
    
  2. Copy+paste:

    sudo apt-get update
    
    sudo apt-get install -y tcsh xfonts-base python-qt4       \
                            gsl-bin netpbm gnome-tweak-tool   \
                            libjpeg62 xvfb xterm vim curl     \
                            gedit evince                      \
                            libglu1-mesa-dev libglw1-mesa     \
                            libxm4 build-essential            \
                            gnome-terminal nautilus           \
                            gnome-icon-theme-symbolic         \
                            firefox
    

    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.

Install AFNI binaries

  1. Copy+paste:

    cd
    curl -O https://afni.nimh.nih.gov/pub/dist/bin/linux_ubuntu_16_64/@update.afni.binaries
    tcsh @update.afni.binaries -package linux_ubuntu_16_64  -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.

    Note

    If the binary package has already been downloaded somewhere, instead of the above you can use -local_package with the location+name of the binary file, e.g.:

    tcsh @update.afni.binaries -local_package linux_ubuntu_16_64.tgz -do_extras
    

Install R

  1. 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 https://afni.nimh.nih.gov/pub/dist/src/scripts_src/@add_rcran_ubuntu.tcsh
      sudo tcsh @add_rcran_ubuntu.tcsh
      
    • ... 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 https://afni.nimh.nih.gov/pub/dist/src/scripts_src/@add_rcran_ubuntu.tcsh
      sudo tcsh @add_rcran_ubuntu.tcsh
      

    Purpose: Setup modern R from scratch. This relies on the environment variable $R_LIBS, which specifies where to install the packages and where to read them from later (when R programs run). The file obtained using curl contains instructions to add a more uptodate set of R libraries to the source list.

  2. Copy+paste:

    rPkgsInstall -pkgs ALL
    

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

Make AFNI/SUMA profiles

  1. Copy+paste:

    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.

Prepare for Bootcamp

  1. Copy+paste:

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

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

  3. Pro tip: If you will be attending a Bootcamp, you might want to bring a mouse to use with your laptop. It will be easier to follow the demos using a mouse than a trackpad.

Evaluate setup/system (important!)

  1. Copy+paste:

    afni_system_check.py -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:

    afni
    suma
    

    Report any crashes!

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

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 ls="ls --color"'    >> ~/.bashrc
    echo 'alias ll="ls --color -l"' >> ~/.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.

  2. Also, consider running gnome-tweak-tool and changing Windows -> Focus Mode from ‘click’ to ‘mouse’.

  3. Also, consider extending time for screen saver: System Settings -> Brightness & Lock, and set inactivity duration.

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!

Note

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.