ROOT Version: Not Provided Platform: Ubuntu 20.04 Compiler: Not Provided
My apologies for such a basic question, but how do I actually install ROOT? I’m on Ubuntu 20.04 (the latest release), and I’ve spent the better of 4 days trying to install ROOT. I’ve followed various tutorials online, several guides, and the ROOT documentation. All are slightly different, and none have worked for me. I’ve encountered far too many errors to list here, at various steps of the process. I’ve done a clean install of Ubuntu twice. I’ve spent too much time playing around with this. Can someone tell me how to actually install ROOT for my system? Thanks so much in advance!
I start by installing the package “build-essential”:
sudo apt install build-essential
Then go here: https://root.cern/build-prerequisites#ubuntu
and install the “required” prerequisites they list (to be safe, even if you won’t be compiling root, as I show here). You can install them one by one or use the “sudo” command they provide (below the list) for the “Required packages”; some will have been installed already with build-essential, so you may want to go one by one (also get the optional packages if you want, but not really needed, unless you know you need them).
Then go here: https://root.cern/downloading-root
and click on the latest Pro release. As of today, it takes you to v. 6.20/04 https://root.cern/content/release-62004
From there, download the binary package for your Ubuntu and gcc versions. There’s no Ubuntu 20.04 yet but the one for “Ubuntu 19 gcc9.2” works (root_v6.20.04.Linux-ubuntu19-x86_64-gcc9.2.tar.gz).
Extract everything inside, to any folder, e.g.
tar xzvf root_v6.20.04.Linux-ubuntu19-x86_64-gcc9.2.tar.gz /home/myusername
which creates a folder called “root” (you can rename it, e.g. to “root62004”). Then add this line at the end of your /home/myusername/.bashrc file:
source /home/myusername/root62004/bin/thisroot.sh
save it and close the terminal. Of course, change “myusername” and “root62004” in the paths above to whatever is your case. Now every time you open a terminal just type “root” and it should run.
Hi,
the easiest way is probably to install ROOT in a conda environment. From the terminal:
# first install conda (instructions at https://docs.conda.io/en/latest/miniconda.html#linux-installers)
$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ bash Miniconda3-latest-Linux-x86_64.sh # and just follow the instructions on the terminal
# then install ROOT
$ conda create -c conda-forge --name <my-environment> root
$ conda activate <my-environment>
Whenever you want to have ROOT available in a terminal, you have to first give the command conda activate <my-environment>.
The second easiest way, in my opinion, is what @dastudillo described. To summarize the essential steps, that they described nicely in detail above:
download and unpack a pre-compiled binary (no need to compile anything, but make sure you download a “Binary distribution” and not the “Source distribution”)
Whenever you want to have ROOT available in a terminal, you have to first give the command source path/to/unpacked/root/bin/thisroot.sh
Note that we currently do not have pre-compiled binaries for Ubuntu 20.04. I think the ones for Ubuntu 19 should just work.
Very soon we will have an even simpler method (download a root.deb package and apt install root.deb). Stay tuned
Just want to add onto what others have posted. Here’s the whole process that I went through to install root onto Ubuntu 20.04.
First, download the prerequisite from https://root.cern.ch/build-prerequisites#ubuntu for ubuntu. The two lines of code you will need are:
sudo apt-get install gfortran libssl-dev 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 libqt4-dev
You may encounter some problems with the libqt4-dev since ubuntu 20.04 doesn’t carry qt4 anymore. However, if you need it (I think Geant4 uses it), then replace libqt4-dev with qt5-default
Once that’s done, you can then start with installing root. Go to https://root.cern.ch/content/release-62004 and download the source file (root_v6.20.04.source.tar.gz). Next, use the following commands to install it, starting from the $HOME directory:
make -jN (where N is the number of cores your machine has, the more core you provide, the quicker this step will be)
make install
cd …/root-install/bin
. thisroot.sh
root
At this point, you should be able to start using root. However, if you want to be able to run root anywhere (at this moment, if you close the terminal, start a new one, it will not recognize the command root), you need to add some stuff onto your bash like follow:
Try (in case of problems, inspect the three created “*.out.txt” files):
# ... assuming you are using a bash like shell ...
# cd /wherever/you/want/to/build/it
VERSION=6.20.06 # which ROOT version should be downloaded and built
rm -rf root-${VERSION} root-build root-install # cleanup
wget -c https://root.cern/download/root_v${VERSION}.source.tar.gz
tar -zxf root_v${VERSION}.source.tar.gz
mkdir root-build
cd root-build
cmake -DCMAKE_INSTALL_PREFIX=${PWD}/../root-install -Dall=ON ../root-${VERSION} 2>&1 | tee -a cmake.out.txt
nice make -j `nproc` 2>&1 | tee -a make.out.txt
nice make install 2>&1 | tee -a make.intall.out.txt
BTW. Do not modify ROOT related environment variables manually. Always use:
source /full/path/to/your/root/bin/thisroot.sh # setup your ROOT