Notes on CentOS8 installation of Geant4: introduction, compilation and installation of Geant4

If the article is original, please indicate the source of the original text
This blog address:
Dear readers, the knowledge is infinite and the manpower is poor. Either change the demand, find professionals or study by yourself
The complete blog of red fat man (red imitation): the collection of development technologies (including Qt practical technology, raspberry pie, 3D, OpenCV, OpenGL, ffmpeg, OSG, single chip microcomputer, combination of software and hardware, etc.) is continuously updated
Others (programming related)

No: last one
Next: please look forward to


  on the server centos8 Install geant4 software on 2.



Geant4 is a toolkit for simulating particles passing through matter. Its applications include high energy, nuclear physics and accelerator physics, as well as medical and space science research. Three main reference papers of Geant4 were published in nuclear instruments and methods in physical research A 506 (2003) 250-303, IEEE Transactions on Nuclear Science 53 No. 1 (2006) 270-278 and nuclear instruments and methods in physical research A 835 (2016) 186-225.


  the current latest version is 4.11, which is the version on December 10, 2021.


  download from the official website:
   there are 14 documents in total, as shown in the figure below:

Pre installed packages

  • gcc
yum install gcc
  • cmake
yum install cmake

Compile and install Geant4

Step 1: unzip geant4


mkdir /path/to -p

   then copy it in and unzip it, as shown in the following figure:

Step 2: use CMake configuration

mkdir /path/to/geant4-v11.0.0-build
cd /path/to/geant4-v11.0.0-build

  this is a configuration without qt installed

cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4-v11.0.0-install /path/to/geant4-v11.0.0

  this is the configuration with qt installed

cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4-v11.0.0-install GEANT4_USE_QT=ON /path/to/geant4-v11.0.0

  error "could NOT find EXPAT (missing: EXPAT_LIBRARY EXPAT_INCLUDE_DIR)", as follows:

yum install -y expat expat-devel

  then continue configuration:

cmake -DCMAKE_INSTALL_PREFIX=/path/to/geant4-v11.0.0-install /path/to/geant4-v11.0.0

  configuration succeeded:
  configure again:
  look at the previously downloaded:
   copy and unzip:

mkdir /path/to/geant4-v11.0.0-install/share/Geant4-11.0.0/data -p
cd /path/to/geant4-v11.0.0-install/share/Geant4-11.0.0/data
cp /home/yang/work/src/* . -Rf


tar xvf G4ABLA.3.1.tar.gz
tar xvf G4INCL.1.0.tar.gz
tar xvf G4PhotonEvaporation.5.7.tar.gz
tar xvf G4RealSurface.2.2.tar.gz
tar xvf G4EMLOW.8.0.tar.gz
tar xvf G4NDL.4.6.tar.gz
tar xvf G4PII.1.3.tar.gz
tar xvf G4SAIDDATA.2.0.tar.gz
tar xvf G4ENSDFSTATE.2.3.tar.gz
tar xvf G4PARTICLEXS.4.0.tar.gz
tar xvf G4RadioactiveDecay.5.6.tar.gz
tar xvf G4TENDL.1.4.tar.gz

Step 3: compile make

   start compiling, using multithreading -j4:

cd /path/to/geant4-v11.0.0-build
make -j4

  it'll take about ten minutes:

Step 4: install

  install to default path:

make install


Test run environment

  introducing GEANT4 Environment variables for SH:

source /path/to/geant4-v11.0.0-install/bin/

   use the built-in example in the source code to verify:

cd /path/to/geant4-v11.0.0/examples/basic/B1
mkdir build
cd build
cmake ..





   check the interface system that is not displayed when an error is reported. At present, we do not install Qt5. The interface of the system used by default when we install it is shown in the following figure:
   intercept the above error, as shown in the following figure:
   does the expat resolution not support this? Through subsequent tests, Qt5 needs to be installed and Qt5 interface library needs to be used.

Last: No
Next: please look forward to

If the article is original, please indicate the source of the original text
This blog address:

Keywords: centos8

Added by goobers on Mon, 07 Mar 2022 05:39:06 +0200