# Getting Started with Geant4

May 25 – 31, 2021
CERN
Europe/Zurich timezone

# Installing the Geant4 virtual machine

The Geant4 Virtual Machine provides a recent version of the Geant4 source code, examples and libraries, and also a compiler and extra software which such as a large set of visualisation libraries.  It provides a fully working Geant4 system.

It avoids the effort to find and install the key pieces needed to create an installation on your own system, which varies depending on the OS, its version and many other factors.  Of these the installation of user interface and visualisation libraries are the trickiest.

This is the only method that we will support for this course.

The following information is a summary of the key steps. Further guidance can be found at the CENBG home of the Geant4 Virtual Machine.

### Step 1: Ensure that your machine can run the Geant4 Virtual Machine

Make sure that your computer meets the minimum requirements:

• Windows or Linux users : desktop or laptop PC running Windows (preferably 10)
• Linux: desktop or laptop PC with a recent Linux release (able to run VMware workstation for Linux)
• Mac users : Mac with Intel processor (not the 2020-21 M1 models) and a recent version of macOS (capable of running the virtualization software below)
• at least 30 GB of free disk space available
• at least   4 GB of RAM available for the virtual machine on the PC or Mac - so likely a total of at least 6 or 8 GB installed.

### Step 2: Obtain a Virtual Machine 'player'

There is a choice of Virtual machine host software:

• The host software (player) from VMware, Inc is our recommendation:
• If you identify issues with the recommended software or versions, please inform us.

### Step 3: Obtain the Geant4 virtual machine

Obtain the Virtual machine file which corresponds to your player, and uncompress it:

• Download the  Geant4 Virtual Machine.  Note that the VM file is quite large (12.52 GBytes), and may take a long time to download (will depend greatly on your network bandwidth).
• we recommend to start to download it at least 2 weeks before the course, to ensure that you can obtain it, and to familiarise yourself with it.
• Note: The current VM is in a single configuration with the AZERTY (French) keyboard layout as default. It can be changed simply to use a QWERTY (US) keyboard layout.  See below.

### Step 4: Uncompressing

• You need software which can un-compress '7z' files. There are many other choices, such as the popular (de-)compressor WinZip

### Step 5: Opening the Virtual Machine

• Use the files you downloaded to start a Virtual Machine with Geant4:

• You should find a new directory G4.10.07.p01_CTOS8 at this location.
• Check that you can find the following uncompressed files in this directory
G4.10.07.p01_CentOS8-src-foo1.vmdk
G4.10.07.p01_CentOS8-src-foo2.vmdk
G4.10.07.p01_CentOS8-src.vmdk
G4.10.07.p01_CentOS8.nvram
G4.10.07.p01_CentOS8.vmdk
G4.10.07.p01_CentOS8.vmx         <----- the key file
G4.10.07.p01_CentOS8.vmxf 
• Open that file using the corresponding program - i.e. use VMware Workstation, VMware Player, or VMware Fusion.
• G4.10.07.p01_CentOS8.vmx
• Note that you may encounter issues on opening this file:
• on PC, including Windows and some Linux systems you will likely need to enable features needed for virtualisation in the BIOS.  This is needed if you encounter a message such as "Intel Vtx is disabled..."
• on earlier versions of macOS, you may get a message like: "Could not open /dev/vmmon: No such file or directory. Please make sure that the kernel module 'vmmon' is loaded." This can be fixed by Opening the "Security and Privacy" dialog of "System Preferences", and from "General" tab looking for the message "System software from developer "VMware, Inc." was blocked from loading." If you click the Allow button, it should resolve the issue (for further details about this topic, please see the item on stackexchange).
• On macOS you may need to grant access to some resources to Fusion -- this may need a reboot.

### Step 6: Locate the Geant4 installation and check it

• The virtual machine will boot.  It will take a few minutes,
• You should now obtain a (Linux) desktop, which is mostly empty.
• Its menus can be found in the top left corner (icon and 'Activities').
• It's keyboard is configured as French 'AZERTY'.  You can change this to 'QWERTY' by using the menu 'Fr' in the top right corner.
• You can make it full screen using the icon with a rectangle inside a partial four corners.
• Open a Terminal window using the icon/"Activities":
• Look for the rectangle with a silver border around a prompt (in this menu) and you use it to obtain a Terminal.
• You should see a new window, ready to accept your commands
• It is running the command shell 'tcsh'
• Locate Geant4
• The Geant4 installation is located under the path defined for the $G4COMP environment variable. Type the following • echo$G4COMP
• /usr/local/geant4.10.07.p01/share/Geant4-10.7.1
• cd $G4COMP • ls • echo$G4EXAMPLES
• /usr/local/geant4.10.07.p01/share/Geant4-10.7.1/examples
• cd $G4EXAMPLES • ls • advanced/ basic/ CMakeLists.txt extended/ ..... • Build and run an example as an extra check • Please try to build the B1 example using the following commands: cd mkdir -p geant4/work/buildB1 cd geant4/work/buildB1 cmake$G4EXAMPLES/basic/B1
make -j4
./exampleB1 exampleB1.in
./exampleB1   
• DONE

We thank CENBG and CNRS for providing the Geant4 Virtual Machine, which is described in the article Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178, for updating it regularly and promptly with each production release and patch, and for their helpful collaboration.