CERN ROOT Installation on Ubuntu 20.04

Installing CERN ROOT (2016) - Nick's Reasearch Page

Hello readers, today we shall learn to build CERN-ROOT-6 from the source file on Ubuntu 20.04. Follow the following steps to install. For another version change accordingly. ROOT is a framework for data processing, born at CERN, at the heart of the research on high energy physics. Every day, thousands of physicists use ROOT application to analyze their data or to perform simulations.

1. First Clone the repository:

Run this command:


$ git clone --branch v6-22-00-patches https://github.com/root-project/root.git root_src

#It is the official repository.

2. Install required packages:


$ sudo apt-get install dpkg-dev cmake g++ gcc binutils libx11-dev libxpm-dev \
libxft-dev libxext-dev python openssl


You can find these packages here: https://root.cern/install/dependencies/


3. Install Optional Packages:


$ sudo apt-get install gfortran libpcre3-dev \

xlibmesa-glu-dev libglew1.5-dev libftgl-dev \

libmysqlclient-dev libfftw3-dev libcfitsio-dev \

graphviz-dev libavahi-compat-libdnssd-dev \

libldap2-dev python-dev libxml2-dev libkrb5-dev \

libgsl0-dev

4. To use python3 in the Root (pyROOT), we need python3 devel packages.


$ sudo apt install python3-dev


5. Download the Source file:

Make a separate directory for fresh installation

$ cd /home/user                                    #home directory

$ mkdir software                                  : It will create a folder in the home directory.

$ cd software                                         : Go inside the directory

$ mkdir root                                           : It will create another folder in the software folder.

$ cd root

$ sudo apt install wget                         : wget is the internet tool. Install it if not installed already.

$ sudo wget https://root.cern/download/root_v6.22.02.Linux-ubuntu20-x86_64-gcc9.3.tar.gz    

                                                                 : find the source file address form here: https://root.cern/install/all_releases/

$ sudo tar zxf root_v6.22.02.source.tar.gz      : Extract file

$ sudo mv root-6.22.02/ 6.22.02

#user : replace it with your PC name.

6. Configure:


$ sudo mkdir 6.22.02-build

$ cd 6.22.02-build

$ sudo cmake -DCMAKE_INSTALL_PREFIX=/home/user/software/root/6.22.02 /home/user/software/root/6.22.02

7. Build the root :


$ sudo cmake –build . -- -jN

where N is the number of cores in the processor: to know that run this in terminal: $ nproc

this process will take time as it depends on the hardware. It may take up to 1 hr.


8. Install:


$ sudo make install


9. Setup ROOT in your environment:


$ source /home/sourcefile/software/root/6.22.02-build/bin/thisroot.sh


Note: save this in the .bashrc file to run ROOT in the terminal from any directory.


For this go to the home directory and find the .bashrc file if not appeared then press ctrl+h and save the above command in this file at the end without disturbing anything and save.


10. Check: to check whether the root is installed or not:

type in terminal:


$ root –version 


$ root




if this kind of output comes, i
t means that you have installed root successfully.


11. To check if the ROOT support python3, type following command:


$ root-config –features


If output comes like that:

cxx11 asimage builtin_afterimage builtin_clang builtin_gl2ps builtin_llvm builtin_lz4 builtin_lzma builtin_tbb builtin_vdt builtin_xrootd builtin_xxhash builtin_zstd clad dataframe exceptions fftw3 fitsio gdml http imt mathmore mlp mysql opengl pyroot roofit runtime_cxxmodules shared ssl tmva tmva-cpu spectrum vdt x11 xml xrootd


Then ok, Congratulations. You have successfully installed ROOT and also can use python3 in ROOT.

Post a Comment

0 Comments