Download Source
1. Create (if necessary) and go to a clean directory
2. Determine the version of ROOT that you want to download (see, for example, https://root.cern.ch/downloading-root).
3. For example, as I write this, the "production" version is 6.16.00
4. Download this by a command of the form:
wget https://root.cern.ch/download/root_vn.nn.nn.source.tar.gz
In my case, I therefore executed:
wget https://root.cern.ch/download/root_v6.16.00.source.tar.gz
Extract the source tree:
tar -zxf root_v6.16.00.source.tar.gz
Build ROOT
Make a subdirectory that will eventually serve as the root of the ROOT hierarchy. [Yes, "ROOT" is an unnecessarily confusing name for this software.] Assuming I call this directory ROOTroot, then:
mkdir ROOTroot
cd ROOTroot
cmake ../root-6.16.00
cmake --build
Do other stuff for a couple of hours or so, because buliding ROOT takes a long time. When the build has completed, a complete hierarchy based at ROOTroot should have been built. On my system, that hierarchy runs to about 3.1 GB.
Prepare your shell for executing ROOT
Now execute:
. bin/thisroot.sh
Test ROOT
Now you should be able to execute ROOT simply by typing:
root
Move the ROOT tree if necessary
The entire hierarchy based at ROOTroot may be copied or moved somewhere more convenient if you decide that you've built ROOT somewhere other than where you want it to reside. For example, suppose we want ROOT to be in ~/ROOT, then we execute:
cp -r . ~/ROOT
to copy the entire ~3GB hierarchy. Then, to use ROOT, we dot-execute the script thisroot.sh in the bin directory under the new root(!) of the hierarchy. So, for example:
. ~/ROOT/bin/thisroot.sh
After this, ROOT may be started simply executing:
root
Access ROOT easily from subsequent sessions
In order to make ROOT easily available simply by typing
root
in subsequent sessions, you may want to add the command:
. ~/ROOT/bin/thisroot.sh
to your ~/.bashrc file, or its equivalent for your bash-like shell.