Earthworm Installation Procedure: Linux
Steps to Compile Earthworm on 64-bit Ubuntu (v11.04)
Required software
- GNU C++ Compiler
sudo apt-get install g++
- GNU C++ Compiler (multilib files)
sudo apt-get install g++-multilib
- subversion
sudo apt-get install subversion
- (to obtain multilib files for non-Ubuntu Linux OS see: http://www.cyberciti.biz/faq/x86_64-linux-error-gnustub-32h-missing-error-and-solution/)
Step-by-Step process for compilation
- make a new directory called "ew"
cd /home/[...]
mkdir ew
- Download EW package from: http://folkworm.ceri.memphis.edu/ew-dist/
Click on "Source tar"
Download to /home/[...]/ew
- Un tarball the source files (this will extract them):
cd /home/[...]/ew
tar -xzvf v7.5-src.tar.gz
- Create the parameter directory /home/[...]/ew/run/params
cd /home/[...]/ew
mkdir run
cd run
mkdir params
- Copy into /home/[...]/ew/run/params the file ew_linux.bash that you will find at /home/[...]/ew/earthworm_7.5/environment:
cd /home/[...]/ew/earthworm_7.5/environment
cp ew_linux.bash /home/[...]/ew/run/params
- Set up your environment before you try to compile:
cd /home/[...]/ew/run/params
vim ew_linux.bash
CHANGE TO:
... export GLOBALFLAGS="-fno-stack-protector -m32 -Dlinux -D__i386 -D_LINUX -D_INTEL -D_USE_SCHED -D_USE_PTHREADS -D_USE_TERMIOS -I${EW_HOME}/${EW_VERSION}/include" ... export EW_HOME="${EW_INSTALL_HOME:-/home/[...]/ew}" export EW_VERSION="${EW_INSTALL_VERSION:-earthworm_7.5}" EW_RUN_DIR="${EW_RUN_DIR:-$EW_HOME/run}"
do the same at:
vim /home/[...]/ew/earthworm_7.5/environment/ew_linux.bash
- Edit your .bashrc file
vim ~/.bashrc
add to the bottom of this file:
source /home/[...]/earthworm_7.5/environment/ew_linux.bash
- source it
cd /home/[...]/ew/run/params
source ew_linux.bash
source ~/.bashrc
- Compile
cd /home/[...]/ew/earthworm_7.5/src
make unix
Step-by-Step Process for final set up
- Copy params from /home/[...]/ew/earthworm_7.5/params to /home/[...]/ew/run/params
cd /home/[...]/ew/earthworm_7.5/params
cp * /home/[...]/ew/run/params
- Copy a few more .d param files from /home/[...]/ew/earthworm_7.5/environment to /home/[...]/ew/run/params
cp earthworm.d /home/[...]/ew/run/params
cp earthworm_global.d /home/[...]/ew/run/params
cp earthworm_commonvars.d /home/[...]/ew/run_prod/params
- Make log directory
cd /home/[...]/ew/run/
mkdir log
Step-by-Step Process for Configuration
- Modify wave_serverV.d
vim /home/[...]/ew/run/params/wave_serverV.d
CHANGE TO:
... ServerIPAdr 192.168.0.106 ... TankStructFile /home/[...]/ew/datafiles/p1000-1.str ... Tank GUID --- NC -- 528 INST_MENLO MOD_WILDCARD 1 10000 /home/[...]/ew/tankfiles/p1001.tnk Tank IRG1 T NC -- 528 INST_MENLO MOD_WILDCARD 1 10000 /home/[...]/ew/tankfiles/p1002.tnk Tank IRG2 T NC -- 528 INST_MENLO MOD_WILDCARD 1 10000 /home/[...]/ew/tankfiles/p1003.tnk ... TankStructFile2 /home/[...]/ew/datafiles/p1000-2.str ...
Not sure of your ip? Open a cmd window and type "ifconfig" and look for "inet address". ".
Does your ip change a lot? Use 0.0.0.0
- Make a few more directories...
mkdir /home/[...]/ew/tankfiles
mkdir /home/[...]/ew/datafiles
- Modify statmgr.d
vim /home/[...]/ew/run/params/statmgr.d
CHANGE TO:
... RingName WAVE_RING ... CheckAllRings 1 ... Descriptor statmgr.desc Descriptor startstop.desc Descriptor wave_serverV.desc Descriptor tankplayer.desc ...
- Modify tankplayer.d
vim /home/[...]/ew/run/params/tankplayer.d
CHANGE TO:
... InterMessageDelayMillisecs 1 ... WaveFile /home/[...]/ew/tankfiles/file.tbuf ...
- Modify startstop_unix.d
vim /home/[...]/ew/run/params/startstop_unix.d
CHANGE TO:
... nRing 1 Ring WAVE_RING 1024 # Ring PICK_RING 1024 # Ring HYPO_RING 1024 ... # # Process "statmgr statmgr.d" Class/Priority TS 0 # Process "wave_serverV wave_serverV.d" Class/Priority TS 0 # Process "tankplayer tankplayer.d" Class/Priority TS 0 # ...
Make sure to place a # sign in front of all other "Process and "Class/ Priority" lines.
To check configuration works
- Open cmd window to run startstop
Enter:
startstop
- To make sure waves are coming in:
type any of the following into a command window:
sniffring WAVE_RING
sniffwave WAVE_RING wild wild wild wild
getmenu [your ip]:16022
Linux Startup of Earthworm
Traditionally users start earthworm by setting the environment in a shell file, sourcing that, then running startstop. When you want to have Earthworm run automatically in a production system, the process is a bit more involved. First get EW running as a Unix user you want it to run as and make sure you are happy with the location of all files (logs and params) and the environment is configured properly and all works. Next, you need to add a script to the /etc/init.d to help start earthworm when the machine reboots. Here is an example earthworm script to put into init.d. Call it 'earthworm':
#!/bin/sh #chkconfig: 35 95 20 # description: This is the earthworm software start up script # processname: earthworm EW=/opt/earthworm export CLASSPATH=:/opt/earthworm/Winston1.1/lib/winston.jar export PYTHONPATH=:/usr/local/lib/python2.6:/var/python:/var/www:/var:/usr/share/python-support:/usr/local/lib/python2.6/site-packages:/opt/earthworm/ewfe/src case "$1" in start) if [ ! -f $EW/start_earthworm.sh ] then echo "earthworm startup: cannot find start script start_earthworm.sh" > $EW/run_working/logs/start_earthworm.log 2>&1 & exit fi su earthworm -c $EW/start_earthworm.sh > $EW/run_working/logs/start_earthworm.log 2>&1 & ;; stop) su earthworm -c $EW/active_ew/bin/pau ;; restart) $0 stop $0 start ;; *) echo "usage: start " # stop|start|restart" ;; esac
In the /opt/earthworm directory of the above example, we create the shell script start_earthworm.sh, shown below:
#!/bin/bash # Start up earthworm in background cd /opt/earthworm/active_ew source /opt/earthworm/run_working/params/ew_linux.bash startstop >& /opt/earthworm/run_working/logs/startstop &
Then use the Linux chkconfig program (see the manual page) to add it to runlevel 3 and 5. Ie: chkconfig --add earthworm