Geant4 Install Tutorial
Geant4 Install Tutorial
1. The first step in installing Geant4 is to set up a Linux distribution. Here, I am using
Ubuntu 24.04. You can follow the installation guide for Ubuntu 24.04 either for dual boot
(Tutorial Dual Boot Ubunu dan Windows) or on a virtual machine (Tutorial Install
Ubuntu in Virtual Machine) through the following links: Tutorial Install Ubuntu in
Virtual Machine and Tutorial Dual Boot Ubuntu and Windows. If you are using Ubuntu,
make sure to set it to Xorg mode. This is very important for the Geant4 GUI display.
The setting is in the bottom left corner. Choose the "Ubuntu on Xorg" mode.
1
3. Open a terminal and create a folder for installing Geant4
a. Create a directory Software (mkdir Software)
4. Now that you are in the Software/geant4 directory, then extract the downloaded geant4
package tar xzfv ~/Download/geant4-v11.2.2.tar.gz.
2
Make sure that ~/Download/geant4-v11.2.2.tar.gz is the path where you downloaded the
Geant4 package.
After running the comment, the file will be extracted and appear as follows:
7. After that, run this comman: sudo apt install cmake cmake-curses-gui gcc g++
libexpat1-dev qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libxmu-dev
libmotif-dev
3
This command will install CMake, GCC, G++, and various development libraries needed,
including the Qt5 libraries required for the Geant4 graphical user interface.
4
a. Press the "c" key for configuration
5
c. Change CMAKE_INSTALL_PREFIX to
/home/dadan-hidayatuloh/Sorfware/geant4/geant4-v11.2.2-install to match
your system path.
Use the arrow keys to navigate to the options you want to change. Press
Enter to select an option, then use the up and down arrow keys to toggle
between ON and OFF values. For example, if you want to enable Qt support,
navigate to the option GEANT4_USE_QT, press Enter, and change its value to
ON.
6
d. Press c to configure
e. Press g to generate
Make sure you have a good internet connection, because connection can cause the
compilation to fail and result in errors.
7
12. If the compilation is 100%, then continue with the make install comment
13. After that, we need to set up the source so that Geant4 can be used every time.
a. Exit the build directory (cd ..)
8
h. After that, list the directories inside Geant4 (ls)
l. Copied path you can add geant4make.sh at the end of the path.
/home/dadan-hidayatuloh/Software/geant4/geant4-v11.2.2-install/share/
Geant4/geant4make/geant4make.sh
m. The source can now be used (.
/home/dadan-hidayatuloh/Software/geant4/geant4-v11.2.2-install/share/
Geant4/geant4make/geant4make.sh)
or alternatively
(source
home/dadan-hidayatuloh/Software/geant4/geant4-v11.2.2-install/share/
Geant4/geant4make/geant4make.sh)
9
14. At this stage, your Geant4 installation is complete. To ensure that the installation was
successful, you can try running example B1.
a. The first step to run example B1 is to source Geant4 by executing the command ( .
/home/dadan-hidayatuloh/Software/geant4/geant4-v11.2.2-install/share/
Geant4/geant4make/geant4make.sh) or alternatively (source home/dadan-
hidayatuloh/Software/geant4/geant4-v11.2.2-install/share/Geant4/
geant4make/geant4make.sh).
10
h. Enter examples/basic/B1 (cd examples/basic/B1)
11
And after running the ./exampleB1 command, the GUI of example B1 will come
out, here is the GUI display of example B1:
o. If you want to fire a particle beam you can run the /run/beamOn [number of
particles] command in the session section and enter to run.
12
13