GEANT4 installation on Ubuntu (Aug, 2020)


Source: Geant4 Installation Guide


Prerequisites:

gcc 4.9.3 or higher

cmake 3.8 or higher. If on Ubuntu 16 (as dhcp92) and available cmake version is not updated→ add the Kitware repo and update using these instruction (source)

sudo apt-get update

sudo apt-get install apt-transport-https ca-certificates gnupg software-properties-common wget

wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null

sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main'

sudo apt-get update

sudo apt-get install cmake


sudo apt install expat xerces-c++ qt5-default


On Linux CentOS 7 (CERN) install some devtoolset (7, or 8, 9, …) and enable it on the bash session before using cmake

su root

yum install devtoolset-y

scl enable devtoolset-7 bash


Problems with data download on CentOS? (option -DGEANT4_INSTALL_DATA=ON) → use this script to manually download them



mkdir Geant4

cd Geant4

wget http://cern.ch/geant4-data/releases/geant4.10.06.p02.tar.gz

tar -xvzf geant4.10.06.p02.tar.gz

mkdir geant4.10.06.p02_build

cd geant4.10.06.p02_build

cmake -DCMAKE_INSTALL_PREFIX=/home/insudaq/Geant4/geant4.10.06.p02_install -DGEANT4_INSTALL_DATA=ON -DGEANT4_USE_QT=ON -DGEANT4_USE_OPENGL_X11=ON DGEANT4_USE_RAYTRACER_X11=ON ../geant4.10.06.p02

make

make install