ROOT Installation
These instructions are intended for the students of my laboratory classes on Statistical Data Analysis for Nuclear and Subnuclear Physics, where I make extensively use of Roofit and TMVA. The guide is updated usually once a year in November, and occasionally after Windows or ROOT major releases, or when I got feedbacks from some user.
As an attitude, I prefer to install ROOT from the binary distribution whenever possible. ROOT is released often ("Bazaar view") and new features and bug-fixings are available to the community very frequently. As a consequence, a normal user can benefit from installing ROOT using the pre-compiled binary distributions. This let you change quickly from one release to next one without spending time with building sources, and leaving the possibility to concurrently store several releases on your disk.
However, as a matter of fact, you can't avoid to compile ROOT from source when you need some specific feature not present in a binary distribution. The list of ROOT features which may (or may not) be included in your release is here: https://root.cern/install/build_from_source/#all-build-options.
This guide shows how to install ROOT with RooFit/RooStats and TMVA feature on your laptop.
[Windows 10/11]
Binary distibution for Windows is released as preview
A binary distribution of the most recent ROOT 6 release including RooFit/RooStats is available starting from Release v6.14/06 (2018 Nov 05). A binary distributions including also TMVA is also available, for example in v6.22 (2020 Aug 17).
Two types of packaging are available: "exe" (a standard Windows Installer) and "zip" (unpack, set up environment variables and run). My preference is for "zip".
I was not able to run these binaries without having Visual Studio installed. So you shall install Visual Studio Community which is available for free (it is a huge installation).
run Ubuntu natively on Windows 10/11 without Virtual Machines.
In this case, you can exploit the Windows Subsystem for Linux and download the binary distribution for Ubuntu.
Instructions:
Check your Windows 10/11 version.
- open a command prompt (WIN+R) "cmd"
- call "systeminfo"
- check "OS version:" or "Versione SO:" ex. "10.0.15063 N/D build 15063"
- check "System Type:" or "Tipo sistema:" ex. "x64-based PC"
if a 32-bit version: forget WSL and follow instructions for Windows 7, 8, 8.1.
if a 64-bit version:
Before going ahead, run Windows Update and update Windows to the most recent build (when possible).
Now, follows the instructions related to your Windows 10 build.
Windows 10, Version 1507 First Release [Build 10.0.10240]
Windows 10, Version 1511 November Update [Build 10.0.10586]
If you cannot update Windows to a more recent build,
forget WSL and follow the instruction for Windows 7, 8, 8.1.
Windows 10, Version 1607 Anniversary Update [Build 10.0.14393]
Windows 10, Version 1703 Creators Update [Build 10.0.15063]
- install "bash linux for windows" following these instructions [https://www.chimerarevo.com/windows/installare-bash-linux-windows-259497/] [https://www.chimerarevo.com/windows/installare-bash-linux-windows-259497/]
- Then, follow the instruction above for Windows 10, Fall Creators Update starting from item 3.
Windows 10, Version 1709 Fall Creators Update [Build 10.0.16299]
or higher....
- Click the Start charm, type cmd, right-click the Command Prompt tile, and then click Run as administrator
- type "wsl --install"
- Reboot
Alternative
- Turn the "Windows Subsystem for Linux" on (ITA: "Sottosistema Windows per Linux"):
Control Panel -> Programs -> Turn Windows features on or off
(ITA) Pannello di Controllo -> Programmi e funzionalità -> Attiva o Disattiva funzionalità Windows
- Install Ubuntu from Windows Store.
- Reboot
- Check the Ubuntu version before continue:
- open a command prompt and type "bash"
C:\>bash
- after bash is started, type "cat /etc/issue"
myself@mycomputer:/mnt/c$ cat /etc/issue
- Download the ROOT Binary distribution specific for your Ubuntu from the ROOT web site:
- Ubuntu 22
- Ubuntu 20
- Ubuntu 18 (default if Windows is Build 10.0.17763 but check before continue!)
- Ubuntu 16 (default if Windows is Build 10.0.15063 but check before continue!).
- Ubuntu 14 (default if Windows is Build 10.0.14393 but check before continue!)
Example: root_v6.10.06.Linux-ubuntu16-x86_64-gcc5.4.tar.gz is for UBUNTU 16
- unzip the file in a folder, i.e. in c:\ROOT\root_v6.10.06.Linux-ubuntu16-x86_64-gcc5.4
DON'T unzip the file using windows applications (as 7-zip) because some symbolic links are not properly uncompressed (this comment is for root_v6.18.00 or more)
You must uncompress the file from the bash, in the following way:
open a command prompt, go to the folder you want to unzip the root binaries (can be under windows file system if you want) and type "bash" and then untar
c:\...\>bash
$ cd the-folder-where-you-want-to-unzip-the-root-binaries
$ tar -xvf the-folder-containing-the-zipped-file/root_v6.10.06.Linux-ubuntu16-x86_64-gcc5.4.tar.gz
if you decide to unzip in the Windows filesystem (/mnt/c/... is the mounting point of disk C:) you may have some errors during the uncompression due to the lack of access rights to the folder where you want to unzip.
in case you're facing this kind of problems, try again using "sudo":
$ sudo tar -xvf the-folder-containing-the-zipped-file/root_v6.10.06.Linux-ubuntu16-x86_64-gcc5.4.tar.gz
- Install the packages required to run ROOT in Ubuntu [https://root.cern/install/dependencies/#ubuntu-and-other-debian-based-distributions] [https://root.cern/install/dependencies/#ubuntu-and-other-debian-based-distributions]
- $ sudo apt-get update (mandatory the first time you run the bash shell)
- $ sudo apt-get install dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev libxft-dev libxext-dev python libssl-dev
- Other packages not listed in the ROOT web site, but required when running Ubuntu on a WSL :
- $ sudo apt-get install libtiff5 # for DISPLAY
- $ sudo apt-get install x11-apps # for DISPLAY
- $ sudo apt-get install libatlas3-base # for TMVA
- $ sudo apt-get install libtbb-dev # for ROOT 6.12/06 and higher
- $ sudo apt-get install libgsl0-dev # for ROOT 6.18 and higher
in one line:
- $ sudo apt-get install libtiff5 x11-apps libatlas3-base libtbb-dev libgsl0-dev
other required packages:
- $ sudo apt-get install libgsl23 libblas3 # for ROOT 6.26 and higher
- $ sudo apt-get install libfftw3 # for ROOT 6.26 and higher
or alternatively
- $ sudo apt-get install libfftw3-3
- $ sudo apt-get install libtbb-dev # for ROOT 6.30 and higher
- $ sudo apt-get install libgif-dev # for ROOT 6.32 and higher
Optional packages: you may be also interested in some ROOT features which needs other additional packages listed here: https://root.cern/install/dependencies/#most-common-optional-packages-1
- the new, web based ROOT Browser
starting from ROOT v6.28 a new web-based ROOT Browser is open when
"new TBrowser" command is called.
You can choose one of the two::
[1] switch back to old one based on canvas, starting ROOT with
$ root --web=off
or permanently change the default as explained here:
https://root-forum.cern.ch/t/tbrowser-opening-in-my-web-browser-instead-of-a-root-file-explorer-like-window/55875
This is recommended with WSL to save time.
[2] install firefox as classic Deb in Ubuntu 22.04 & 24.04,
given that firefox snap is not working well on WSL.
Follows these instructions:https://askubuntu.com/questions/1444962/how-do-i-install-firefox-in-wsl-when-it-requires-snap-but-snap-doesnt-work
which says in short (you might need to skip the first two if you already did those):
- $ sudo snap remove firefox
- $ sudo apt remove firefox
- $ sudo add-apt-repository ppa:mozillateam/ppa
# Create a new file, it should be empty as it opens:
- $ sudo nano /etc/apt/preferences.d/mozillateamppa #
# Insert these lines, then save and exit
Package: firefox*
Pin: release o=LP-PPA-mozillateam
Pin-Priority: 501
# after saving, do
- $ sudo apt update
- $ sudo apt install firefox
CONTINUE IF YOU ARE RUNNIN WINDOWS 10
ALL THE FOLLOWING MUST BE CONSIDERED OBSOLETE IN WINDOWS 11
- Download a free-to-use X-server, i.e. MobaXTerm [https://mobaxterm.mobatek.net/] [https://mobaxterm.mobatek.net/]
- set the DISPLAY
- $ cd $HOME
- $ nano .bashrc
if WSL1:
add "export DISPLAY=:0"
(without quotation marks) at the end of the file
if WSL2
add "export DISPLAY=$(grep -m 1 nameserver /etc/resolv.conf |awk '{print $2}'):0"
(without quotation marks) at the end of the file
save the file (ctrl+o) and close the editor (ctrl+x)
- $ exit (close the bash shell)
- run ROOT
- run MobaXterm and wait for the "X Server" icon become green
- open a command prompt and type "bash":
- c:\....\>bash
- $ source /mnt/c/ROOT/root_v6.10.06.Linux-ubuntu16-x86_64-gcc5.4/root/bin/thisroot.sh
- $ root
To store the environment variables for the next session, we suggest to add "source /mnt/c/ROOT/root_v6.10.06.Linux-ubuntu16-x86_64-gcc5.4/root/bin/thisroot.sh" at the end of the file .bashrc
NOTE: a new version of the Windows Subsystem for Linux is available called WSL2, that exploits virtualization technology. Sometimes it is required to change BIOS options to enable this. So, we let the user to decide which kind of WSL is better of him (https://docs.microsoft.com/en-us/windows/wsl/compare-versions).
[Windows 7, 8, 8.1]
The ROOT 5.34 distribution for Windows includes RooFit/RooStats packages by defualt. Download from the ROOT site following the link "Download" under "All Releases" (https://root.cern.ch/content/release-53436). Download a distribution for Windows, i.e. root_v5.34.36.win32.vc10.exe. You don't need an external C++ compiler. [THIS SOLUTION IS RECOMMENDED FOR WINDOWS 7, 8 or 8.1 and it runs smoothly and "as is".]
In order to use ROOT v6 with Windows 7, 8 or 8.1 you need installing a Virtual Machine running some Linux OS.
[Linux,MacOS]
There are several ways to install ROOT, as well described in the ROOT site:
https://root.cern/install/
My preference is for pre-compiled binary distribution:
1. Install all required dependencies [https://root.cern/install/dependencies]
2 Follow instructions here: https://root.cern/install/#download-a-pre-compiled-binary-distribution
Note for MacOS: to properly run Root 6 you shall have installed XCode in folder /Applications
Note: you can also install ROOT directly via a package manager [https://root.cern/install/#install-via-a-package-manager], as for example:
- $ sudo apt-get install root-system
This kind of installation has a few drawbacks. The number of available ROOT libraries may be limited; you will probably face troubles in concurrently use several ROOT distribution on the same disk; the ROOT version may not be the most recent; ... .