This article will show you how to set up your Ubuntu machine for GEANT4 and ROOT development.
0.1) Install Ubuntu 8.0.4
Install Ubuntu 8.0.4 and complete basic setup such as networking.
0.2) Install Necessary Package
Install the following packages using “apt-get install” command.
1) Set up Root
Obtain the latest Root from http://root.cern.ch. I used Root version 5.18.
Unzip the Root package to the location of choice, say ~/mt-sys. After unzipping, there will be a “root” directory in ~/dev. We will come back in the later step to set up root configuration.
To build Root from source, download the source ball, unzip it, then change to the source directory
#tar -zxvpf <root_src>.tar.gz
# make install
Notes on tar options used above
-z : unzip the file first
-x : extract the files from the tarball
-v : “verbose” (i.e tar tells you what files it’s extracting)
-p : preserves dates, permissions of the original files
-f : use the file in question (if you don’t specify this, tar just sort of sits around doing nothing)
Add the following lines to your ~/.bashrc file
2) Set up CLHEP
To build CLHEP, you need gcc-3.2.3 or higher.
Obtain CLHEP source package from http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/clhep.html.
I used version 188.8.131.52 ( http://proj-clhep.web.cern.ch/projclhep/DISTRIBUTION/distributions/clhep-184.108.40.206.tgz)
Save the tar ball in a directory of choice, say ~/install. Then unzip and then do configure, make, and make install in the unzipped directory. Note that by default, the CLHEP is installed in /usr/local. I set the installation path to /home/username/dev/CLHEP by doing “./configure â€“-prefix=/home/username/dev/CLHEP”.
tar -zxvpf clhep-<version>.tar
Add the following lines to /home/jessica/.bashrc file
3) Set up Geant4
Obtain the source package from Geant4 site http://geant4.web.cern.ch/geant4/. I used Geant4.8.2.p01 (http://geant4.web.cern.ch/geant4/support/source/geant4.8.2.p01.tar.gz).
Unzip the tar ball to your directory of choice, say ~/geant4. Unzip and then change directory to ~/geant4/geant4.8.2.p01 to run the “Configure” script.
tar -zxvpf geant<version>.tar.gz
Entered the CLHEP_BASE_DIR
You will be asked a series of question and most of them can be answered with a default answer. The questions you need to answer carefully are the path to your CLHEP install (from step 2) .
NOTE: Instead of libX11-devel, use libX11-dev.
Once geant4 has been installed, you need to create a script named “env.sh” to set the Geant4 environment variables. To create “env.sh” automatically:
cp: overwrite `./env.csh` (enter y)
cp: overwrite `./env.sh`
Two files will be created: “env.sh” and “env.csh”. Next step is to modify the .bashrc script so that this environment variables for CLHEP, Root, and Geant4 will all be set up correctly. I added the following line to ~/.bashrc:
Log out and log back in to your account, then a slew of log messages from running “env.sh” should be printed to the screen.
4) Install MySQL Databaser Server
|sudo apt-get install mysql-server|
Optionally, for remote access, install PHPMYADMIN, a web-based MySQL query browser, as followed:
|sudo apt-get install apache2
sudo apt-get install php5 libapache2-mod-php5
sudo apt-get install phpmyadmin
The phpmyadmin is installed under /var/www, and we need to set phpmyadmin as the default document root in Apache2. To do so
|sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/phpmyadmin
sudo vi /etc/apache2/sites-available/phpmyadmin
Then search for “DocumentRoot” in “/etc/apache2/sites/available/phpmyadmin”, when found, change those two lines to be consistent with the phpmyadmin site path.
Then disable default site and enable phpmyadmin site as followed:
|sudo a2dissite default
sudo a2ensite phpmyadmin
sudo /etc/init.d/apache2 restart
Now you should be able to browse phpmyadmin site by opening http://<ip-of-this-server>.
Also, to have Apache2 recognize a host name, instead of just IP,
|sudo vi /etc/apache2/apache2.conf|
Then add the following line at the top of apache2.conf.
Restart Apache2 HTTP server
|sudo /etc/init.d/apache2 restart|
Now you should be able to browse phpmyadmin site by opening http://server-name.
To enabled remote access to the MySQL Database server, read this nixCraft page.
But the essence is to add a line to my.cnf (in Ubuntu, /etc/mysql/my.cnf), and make sure “skip-networking” line is commented out.
ServerName server-name or IP
Also, to set the firewall so the server can accept remote connections, follow thisÂ Ubuntu doc.
5) Install VTKViewer (Optional)
First we need to install VTK (The Visualization Toolkit) from source.
Install cmake if not already installed:
|sudo apt-get install cmake|
Go to VTK site (http://www.vtk.org/index.php) and download
- VTK source tar ball, vtk-<version>.tar.gz
- VTK data tar ball, vtkdata-<version>.tar.gz
- VTK MPeg encoder, vtkmpeg2encode.tar.gz
Extract the all three tar ball:
tar xvf vtk-<version>.tar.gz
tar xvf vtkdata-<version>.tar.gz
tar xvf vtkmpeg2encode.tar.gz
First build and install vtkmpeg2encode. NOTE: Please build vtkmpeg2encode BEFORE building VTK, so that the VTK’s configure script can detect vtkmpeg2encode, which is required for a successful VTK source build.
You would see the selection as followed:
Leave it unchanged and enter to configure. Then you would see:
Toggle ‘t’ to turn on the Advanced mode and add “-fPIC” at both CMAKE_CXX_FLAGS and CMAKE_C_FLAGS flags
Then press ‘c’ to configure, and ‘g’ to generate make file. After makefile is generated, make vtkmpeg2encode.
To build Visual Tool Kit SDK from source,
Press to configure and [g] to generate makefile.
Press ‘g’ to generate and exit. Then “make” to compile. I’ve added a VOXViewer folder under VTK/Examples, modified VTK/Examples/CMakeLists.txt to include VOXViewer in the build. Therefore, when the build completes, there should be a “voxview” binary in VTK/bin. The voxview needs to read from a vox file, which is located in VTK/Examples/VOXViewer. To run voxviewer and read from a vox file:
Move blinking box to the VTK_DIR line, then hit enter. Enter the path to the VTK directory. Then hit enter, and click ‘g’ to regenerate the build script.
7) Set up Python Development Environment
The list of python modules to install (use apt-get)
I am using Netbean6.5 and for most of my back-end python development and Glade Interface Designer for front-end development. I also like IDLE because it provides python session and can easily indent and dedent but occasionally it crashes.