Install GeneWeb on a shared hosting account

From GeneWeb
Jump to navigation Jump to search
150px-Geographylogo svg.png Language:   English • français

A shared hosting account have some restrictions :

  • Daemon mode is forbidden, or cannot be activated. So you must use CGI mode.
  • You must fit in the server environment : OS version, libraries, installed packages.
  • The OS version is generally a stable version, but not the latest version.

Download a GeneWeb package

Directories and files

The following applies to 1&1 hosting, and may differ on other hostings: Under the root directory where CGI scripts may run, we have : !File:captur477.jpg

The directories :

? Beside the CGI-root directory
mybases The bases directory
? In the CGI-root directory
basesxg An alternative bases directory
css A copy of the gw/css directory. This directory is used by the Apache server.
gw The gw directory of the Geneweb distribution

No change, except give the "exec" permission on the files gw/gwd, gw/gwsetup, and files used by gwsetup (gw/gwc*, gw/gwu,gw/consang, gw/update_nldb) The gwd.arg file is *empty*.

gwenv The gw directory of the Geneweb-5 distribution

On this web site, we can easily switch between the 2 last versions of GeneWeb.

igw The images directory for Geneweb-5
images A directory where copies of gw/images/gwback.jpg, gw/images/gwlogo_bas.png
pub A directory where are readable copies of the CGI scripts (this website is a demo site) :

launch Geneweb-5 launch Geneweb-6 check if Geneweb-6 can be launched

And the files :

issue6.cgi A test script which

- displays information about the environment in the server - checks the gwd binary file : size and md5sum

issue5.cgi The same script, but for the GeneWeb-5 version
gw6.cgi The CGI script which launches GenWeb-6
gw5.cgi The CGI script which launches GenWeb-5

Parameters of the CGI script


Main settings :

  • 1 get the CGI working directory
  • 2-7 set the main parameters
  • 5 $GENEWEBDB does not need to be accessed by the HTTP server.

It must be protected either by a .htaccess file, either by a location out of the HTTP server scope.

  • 7 a log file is useful when there are problems, but do not forget to delete it after downloading.
OPTIONS="-blang -robot_xcl 40,70 -max_clients 15 -conn_tmout 120 -min_disp_req 30 -images_url"
# -allowed_tags $GENEWEBDB/tags.txt

Options and launching

-robot_xcl to protect your data from HTTrack or WebSite Extractor
-conn_tmout for statistics on the bottom line
-images_url icons and images are not sent by GeneWeb, but par your HTTP server (not CGI).
-allowed_tags another useful option, if you use HTML tags not in default_good_tag_list
  • 3 cd $GENEWEBSHARE. I am not sure it is really needed.
  • 4 launch GeneWeb

An alternative installation on 1&1

Some general comments

Installing GeneWeb on a remote shared server is a little bit (but not that much) more complex than on a personal computer. GeneWeb is a totally self contained package, therefore does not depend on additional libraires. On a server, GeneWeb cannot execute in daemon mode (Unix aficionados will understand), and must be launched in CGI mode. To that extent, a server based installation requires prior installation of a (standard) HTTP server (typically Apache), access to the CGI repository of this server and some control over the access rights to the various folders and files. Installing or verifying your HTTP server is not part of this discussion.

A second restriction of GeneWeb on a server is that gwsetup cannot be used (mainly for security reasons). It is therefore necessary to use command lines on the remote server through a ssh window or any other remote access tool of your choice. It is also necessary to have access to a upload mechanism from your personal machine to the server through classical Unix/Linux command lines, or through a ftp client such as Filezilla. A section below will describe in detail a shell script performing upload to the server of a complete fresh copy of a base sitting on your personal computer.

Folders and files

The first important file for your installation is the welcome page of your HTTP server, by default index.html sitting at the root of your server. After personalization of this welcome page, you should verify that you can view it by typing the name (or IP address) of your server in the URL window of your browser.

The second important item is the CGI folder containing the executable files invoqued through URLs. This folder is typically called cgi-bin and also sits at the root of your HTTP server. If this folder contains the following executable file named

echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"   '
echo '   "">  '
echo '<html xmlns="">  '
echo '<body>'
echo 'This is a test for cgi commands'
echo '</body>'
echo '</html>'

then typing in the URL window of your browser the following text


should result in the text This is a test for cgi commands appearing in your browser window.

You must reach this level of functionality to proceed.

At the root of your server, create two additional folders GeneWeb and Documents.

  • The first folder will contain all GeneWeb related files (binaries, bases, images, ...) and need not or should not be accessible with the HTTP server,
  • The second folder will contain any other documents that you may want to share with the visitors of your site.

At this time, we have the following situation:

(uiserver):u72332903:~ > cd
(uiserver):u72332903:~ > ls -al
total 554088
drwx---r-t 23 u72332903 ftpusers      4096 Oct  7 06:58 .
drwxr-xr-t  7 root      root          4096 Oct 23 00:21 ..
-rw-------  1 u72332903 ftpusers      8319 Oct 10 09:30 .bash_history
drwxr-xr-x  3 u72332903 ftpusers      4096 Sep 24 21:24 Documents
drwxr-xr-x 10 u72332903 ftpusers      4096 Sep 24 21:24 GeneWeb
drwxr-xr-x  3 u72332903 ftpusers      4096 Oct  7 06:58 cgi-bin
-rw-r--r--  1 u72332903 ftpusers      3535 May 22 14:30 index.html
-rw-r--r--  1 u72332903 ftpusers        27 Nov  6  2013 robots.txt
(uiserver):u72332903:~ > 

The GeneWeb folder

The GeneWeb folder contains one or more versions of GeneWeb (geneweb-6.08 and geneweb-7.00 in our example), and the bases folder.

Each geneweb-x.yy folder has the same structure, containing a copy of the distribution folder resulting from the compilation of GeneWeb. You can upload with ftp this folder, or you can compile yourself GeneWeb directly on your server, but this necessitates the installation of Ocaml and camlp5 (see Ocaml.

(uiserver):u72332903:~/GeneWeb > cd geneweb-6.08
(uiserver):u72332903:~/GeneWeb/geneweb-6.08 > ls -al
total 204
drwx---r-x  3 u72332903 ftpusers     82 Jan 12  2015 .
drwxr-xr-x 10 u72332903 ftpusers   4096 Sep 24 21:24 ..
-rw----r--  1 u72332903 ftpusers 160302 Jan 12  2015 CHANGES.txt
-rw----r--  1 u72332903 ftpusers  18007 Jan 12  2015 LICENSE.txt
-rw----r--  1 u72332903 ftpusers  10345 Jan 12  2015 START.htm
drwx---r-x  8 u72332903 ftpusers   4096 Dec 17  2014 gw
-rw---r-x 1 u72332903 ftpusers   108 Dec 17  2014 gwd.command
-rw---r-x 1 u72332903 ftpusers   1117 Dec 17  2014 gwsetup.command
(uiserver):u72332903:~/GeneWeb/geneweb-6.08 > 
(uiserver):u72332903:~/GeneWeb/geneweb-6.08 > cd gw
(uiserver):u72332903:~/GeneWeb/geneweb-6.08/gw > ls -al
total 13268
drwx---r-x  8 u72332903 ftpusers    4096 Dec 17  2014 .
drwx---r-x  3 u72332903 ftpusers      82 Jan 12  2015 ..
-rw----r--  1 u72332903 ftpusers   15280 Jan 12  2015 a.gwf
-rwx---r-x  1 u72332903 ftpusers  529764 Jan 12  2015 consang
drwx---r-x 12 u72332903 ftpusers    4096 Dec  2  2014 etc
-rwx---r-x  1 u72332903 ftpusers 1182404 Jan 12  2015 ged2gwb
-rwx---r-x  1 u72332903 ftpusers 1200900 Jan 12  2015 ged2gwb2
-rwx---r-x  1 u72332903 ftpusers  552100 Jan 12  2015 gwb2ged
-rwx---r-x  1 u72332903 ftpusers  631844 Jan 12  2015 gwc
-rwx---r-x  1 u72332903 ftpusers  861434 Jan 12  2015 gwc1
-rwx---r-x  1 u72332903 ftpusers  630084 Jan 12  2015 gwc2
-rwx---r-x  1 u72332903 ftpusers 2422372 Jan 12  2015 gwd
-rw----r--  1 u72332903 ftpusers      12 Jan 12  2015 gwd.arg
-rw----r--  1 u72332903 ftpusers       0 Jan 12  2015 gwd.log
-rw----r--  1 u72332903 ftpusers      42 Oct 10  2014 gwd.xcl
-rw----r--  1 u72332903 ftpusers 3851203 Jan 12  2015 gwdl.log
-rwx---r-x  1 u72332903 ftpusers  358308 Jan 12  2015 gwsetup
drwx---r-x  3 u72332903 ftpusers      68 Jan  3  2015 gwtp_tmp
-rwx---r-x  1 u72332903 ftpusers  589028 Jan 12  2015 gwu
drwx---r-x  3 u72332903 ftpusers    4096 Nov 20  2014 images
drwx---r-x  2 u72332903 ftpusers     140 Jan 12  2015 lang
drwx---r-x  2 u72332903 ftpusers       6 Sep 24  2014 old
-rw----r--  1 u72332903 ftpusers      10 Jan 12  2015 only.txt
drwx---r-x  3 u72332903 ftpusers      33 Sep 24  2014 setup
-rw----r--  1 u72332903 ftpusers     104 Dec 17  2014 tags.txt
-rwx---r-x  1 u72332903 ftpusers  497028 Jan 12  2015 update_nldb
(uiserver):u72332903:~/GeneWeb/geneweb-6.08/gw > 

The cgi folder

The cgi-bin folder contains the cgi commands launching the gwd server software for each request from a browser client.

(uiserver):u72332903:~ > cd cgi-bin/
(uiserver):u72332903:~/cgi-bin > ls -al
total 144
drwxr-xr-x  3 u72332903 ftpusers  4096 Oct  7 06:58 .
drwx---r-t 23 u72332903 ftpusers  4096 Oct  7 06:58 ..
lrwxrwxrwx  1 u72332903 ftpusers     8 Jan 12  2015 Gwd -> Gwd-7.00
-rwxr-xr-x  1 u72332903 ftpusers   183 Oct 10  2014 Gwd-6.08
-rwx---r-x  1 u72332903 ftpusers   183 Jan 12  2015 Gwd-7.00
-rwx---r-x  1 u72332903 ftpusers   183 Jan 15  2015
(uiserver):u72332903:~/cgi-bin > 

Gwd is a symbolic link to the current version of GeneWeb (7.00 in our example).

Each of the gwd-x.yy file is a shell script that launches gwd with the appropriate parameters:


OPTIONS="-robot_xcl 19,60 -allowed_tags ./tags.txt -hd ./"

cd $DIR
./gwd -cgi  $OPTIONS   -bd ../../bases   > ./gwd.log 2>&1

To change your server to another version of GeneWeb (7.00 for instance), you should do the following:

cd cgi-bin
rm -f Gwd
ln -s Gwd-7.00 Gwd

The bases folder

Folder structure for GeneWeb Bases (Genealogy data).

The base folder should contain the same information structure as in the case of installation on a personal computer:

  • one or several basename.gwb folders
  • one or several basename.gwf files
  • cnt containing access count data
  • etc containing template text files used in priority over the generic gw/etc files (see header)
  • images containing for each base photos associated with each person (first_name.occ.last_name.jpg)
  • lang containing some base specific language relates template text files (lexicon for instance)
  • src containing for each base text files and image files inserted in notes with the m=SRC command (see gwd commands)

A script to upload a copy of a base

(Test and report for errors or improvements are welcome Henri83 (talk) 23:32, 23 October 2015 (CEST))

the script in this page takes a base_name as an argument, and optionally images or src. It uploads a fresh base on your server, or a fresh copy of the images/base or src÷base folders. It performs the following steps:

  • creates a fresh file from the base on your personal computer
  • extracts a listing of the content of bases/images/base_name and bases/src/base/images and command files to duplicate the set of links existing from bases/images/base_name to bases/src/base/images
  • creates a file (see below)
  • creates a tar file containing $, history and the three ls-*.txt files above
  • sends the tar file to the remote server
  • triggers on the remote server unfolding of the tar file and execution of The result of this remote execution should be a mail containing the remote.log and the diff between images folders. for base update

# BASE will be replaced by the appropriate name by sed
DATE=$(date +"%y-%m-%d")

echo 'Error log of update for base: BASE' > ./remote.log
echo $DATE >> ./remote.log

# Save current version 
cd ~/GeneWeb/bases 2>> ./remote.log
if [ -d ./BASE.gwb ]  # do it only if folder exists
  mv ./BASE.gwb  ./BASE-$DATE.gwb 2>> ./remote.log

# Extract new base from .tar file
tar xf ~/BASE.tar 2>> ./remote.log
# rebuild BASE from .gw file
../geneweb-VERS_S/gw/gwc1 -f -o BASE 2>> ./remote.log
../geneweb-VERS_S/gw/updnldb BASE 2>> ./remote.log

if [ -f ./BASE.gwb ] # do it only if file exists
  cp -f ./BASE-$DATE.gwb/history ./BASE.gwb 2>> ./remote.log
if [ -f ./BASE.gwb ]  # do it only if file exists
  cp -f ./BASE-$DATE.gwb/forum   ./BASE.gwb 2>> ./remote.log 
# done
cd >> ./remote.log

# Create a link to css.txt in the bases/src folder
ln -s -f ~/GeneWeb/geneweb-$VERS/gw/etc/css.txt ~/GeneWeb/bases/src/BASE/css.txt 2>> ./remote.log

# compute diffs between server and personal computer for image folders
if [ -d ~/GeneWeb/bases/images/BASE ]     # do it only if folder exists
  ls ~/GeneWeb/bases/images/BASE          > ./ls-personnes-serveur.txt
if [ -d ~/GeneWeb/bases/src/BASE/ ]       # do it only if folder exists
  ls ~/GeneWeb/bases/src/BASE/*.txt       > ./ls-src-files-serveur.txt
if [ -d ~/GeneWeb/bases/src/BASE/images ] # do it only if folder exists
  ls ~/GeneWeb/bases/src/BASE/images      > ./ls-images-serveur.txt

echo 'Personnes diff serveur vs local' >> ./remote.log
diff ./ls-personnes-serveur.txt ./ls-personnes.txt >> ./remote.log
echo 'Src files diff serveur vs local' >> ./remote.log
diff ./ls-src-files-serveur.txt ./ls-src-files.txt >> ./remote.log
echo 'Images diff serveur vs local' >> ./remote.log
diff ./ls-images-serveur.txt ./ls-images.txt >> ./remote.log

/usr/bin/mail -s 'Update error log' 'ADDRESS' < ./remote.log
rm -f ./remote.* for images or src update

DATE=$(date +"%y-%m-%d")

if [ -e ./images.tmp ]
  rm -f ./images.tmp
if [ -e ./src.tmp ]
  rm -f ./src.tmp

echo "Error log of update for $FILES of base: BASE" > ./remote.log
echo "`date`" >> ./remote.log 

# Save current version then move new version
if [ -d ./BASE.gwb ]  # do it only if folder exists
  mv ~/GeneWeb/bases/$FILES/BASE  ~/GeneWeb/bases/$FILES/BASE-$DATE 2>> ./remote.log 
mv ./BASE ~/GeneWeb/bases/$FILES 2>> ./remote.log 

/usr/bin/mail -s 'Update error log' 'ADDRESS' < ./remote.log
rm -f ./remote.*