1.1.6. Linux, Rocky¶
These setup instructions are for Rocky Linux version 8.
Things to note before starting¶
- Each step involves either copy+pasting a command, or clicking on a download link. 
- 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.
- Note your terminal shell type ( - bash,- zsh,- tcsh,- csh, etc.), by copy+pasting:- echo $0 
- 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 AFNI Message Board. 
- To copy and paste in a Linux terminal, one can use - Ctrl+Shift+cand- 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.)
- 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 & 
Quick setup¶
This is the quick form of AFNI setup for Rocky 8. It includes downloading the Bootcamp data and running the system check (don’t forget to do that!).
- Download the command scripts. - Copy+paste: - cd curl -O https://raw.githubusercontent.com/afni/afni/master/src/other_builds/OS_notes.linux_rocky_8_a_admin.txt curl -O https://raw.githubusercontent.com/afni/afni/master/src/other_builds/OS_notes.linux_rocky_8_b_user.tcsh curl -O https://raw.githubusercontent.com/afni/afni/master/src/other_builds/OS_notes.linux_rocky_8_c_nice.tcsh Feel free to read any of these, for educational purposes.
- Run command scripts. - Check your shell ( - echo $0), and use the appropriate set of commands below. Running the commands this way creates a text file,- o.rocky*.txt, which can be sent to an AFNI guru for troubleshooting, if necessary.- For bash users: - Copy+paste the following (requires - sudowith password):- sudo bash OS_notes.linux_rocky_8_a_admin.txt 2>&1 | tee o.rocky_8_a.txt 
- Copy+paste the following (no - sudo):- tcsh OS_notes.linux_rocky_8_b_user.tcsh 2>&1 | tee o.rocky_8_b.txt 
- (optional, but useful) To niceify your terminal, copy+paste the following (no - sudo):- tcsh OS_notes.linux_rocky_8_c_nice.tcsh 2>&1 | tee o.rocky_8_c.txt 
 - For tcsh or csh users: - Copy+paste the following (requires - sudowith password):- sudo bash OS_notes.linux_rocky_8_a_admin.txt |& tee o.rocky_8_a.txt 
- Copy+paste the following (no - sudo):- tcsh OS_notes.linux_rocky_8_b_user.tcsh |& tee o.rocky_8_b.txt 
- (optional, but useful) To niceify your terminal, copy+paste the following (no - sudo):- tcsh OS_notes.linux_rocky_8_c_nice.tcsh |& tee o.rocky_8_c.txt 
 
- Evaluate/check the setup - Open a new terminal, and run the AFNI system check: - afni_system_check.py -check_all Read the “Please Fix” section at the bottom, to see if setup is complete.If there are suggested fixes, please do those and re-run the system check.Ask any questions on the Message Board
- Open up the AFNI and SUMA GUIs, juuuust to make sure all is well: - afni suma Report any crashes! Otherwise, you are all set.
 
(slow setup) Install prerequisite packages¶
- Copy+paste: - sudo dnf install -y tcsh gcc motif-devel gsl-devel \ libXpm-devel mesa-libGLw-devel \ mesa-libGLU-devel libXi-devel \ glib2-devel \ python39 python3-matplotlib \ python3-flask python3-flask-cors \ python3-numpy
- Copy+paste: - sudo alternatives --set python /usr/bin/python3 
- Copy+paste: - sudo dnf config-manager --set-enabled powertools 
- Copy+paste: - sudo dnf install -y epel-release R-devel - 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. Note: python3 does not come with ‘python’, we have to ask for that 
(slow setup) Install AFNI binaries¶
- Choose one of the following approaches: - (default) To install the binaries from online, copy+paste: - cd curl -O https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries tcsh @update.afni.binaries -package linux_rocky_8 -do_extras 
- (alternative) To install already-downloaded binaries, use - -local_package ..(replacing- PATH_TO_FILEwith the actual path; also, if- @update.afni.binarieshas also been downloaded, you can skip the- curl ..command), copy+paste:- cd curl -O https://afni.nimh.nih.gov/pub/dist/bin/misc/@update.afni.binaries tcsh @update.afni.binaries -local_package PATH_TO_FILE/linux_rocky_8.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- $PATHin both- ~/.cshrcand- ~/.bashrc.
(slow setup) Install R¶
- Check your shell type ( - echo $0). For …- ... a - tcshterminal, copy+paste:- setenv R_LIBS $HOME/R mkdir $R_LIBS echo 'export R_LIBS=$HOME/R' >> ~/.bashrc echo 'setenv R_LIBS ~/R' >> ~/.cshrc 
- ... a - bashterminal, copy+paste:- export R_LIBS=$HOME/R mkdir $R_LIBS echo 'export R_LIBS=$HOME/R' >> ~/.bashrc echo 'setenv R_LIBS ~/R' >> ~/.cshrc 
 Purpose: Set the environment variable- $R_LIBSto specify where to install+find the R packages.
- Copy+paste: - 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.
(slow setup) Prepare for Bootcamp¶
The AFNI Bootcamp involves hands-on learning with processing and looking at data. The packages installed here include the data, handouts and useful “cheat sheets” of commands. The full download size is several GB, and you should leave at least 10 GB free on your computer after downloading+unpacking the data, to be able to run various examples.
- Copy+paste (to download+upack Bootcamp data to your home directory): - cd curl -O https://afni.nimh.nih.gov/pub/dist/edu/data/CD.tgz tar xvzf CD.tgz cd CD tcsh s2.cp.files . ~ cd .. 
- Copy+paste (to download+upack data for investigating QC in FMRI): - cd curl -O https://afni.nimh.nih.gov/pub/dist/edu/data/boot_qc/bootcamp_qc_sub_rest_A.tgz curl -O https://afni.nimh.nih.gov/pub/dist/edu/data/boot_qc/bootcamp_qc_sub_rest_B.tgz curl -O https://afni.nimh.nih.gov/pub/dist/edu/data/boot_qc/bootcamp_qc_sub_task_A.tgz tar -xf bootcamp_qc_sub_task_A.tgz tar -xf bootcamp_qc_sub_rest_A.tgz tar -xf bootcamp_qc_sub_rest_B.tgz 
- 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:- cd rm CD.tgz rm bootcamp_qc_sub_task_A.tgz rm bootcamp_qc_sub_rest_A.tgz rm bootcamp_qc_sub_rest_B.tgz If you are confident in the downloads+unpacking, 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 the handy Unix documentation/tutorial. This will 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! 
(slow setup) Evaluate setup/system (important!)¶
- Open a new terminal, and then copy+paste: - afni_system_check.py -check_all 
- 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: - afni suma 
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: - afni_system_check.py -check_all > out.ASC.txt - ... and email the file “out.ASC.txt”. 
(slow setup) Niceify terminal (optional, but goood)¶
- 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 - tabautocompletion 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.
- Also, consider running - gnome-tweak-tooland changing- Windows->- Focus Modefrom ‘click’ to ‘mouse’.
- Also, consider extending time for screen saver: - System Settings->- Brightness & Lock, and set inactivity duration.
(slow setup) Install extras (optional, but recommended for Bootcamp prep)¶
- 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… 
(slow setup) Keep up-to-date (remember!)¶
- 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 - apearchhelp information. Update often!
- 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.
A note on setting up Python/using Conda (opt)¶
For this OS, you should not need to do anything further to set up your Python.
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. In fact, your OS might have all the Python+modules needed to run AFNI already. Check this by running:
afni_system_check.py -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.
