Installation

# Chapter 2 Installation

## 2.1 Preliminaries

### 2.1.1 Platforms

Release 0.4.0 contains a source distribution and binary distributions for:

- Linux i686, Fedora (Red Hat Linux 9), with gcc 3.3.2
- Solaris/SunOS 5.8
- Windows 2000, with MinGW compilers

The source form is intended for Unix platforms with GNU compilers, or Windows platforms with Cygwin or MinGW compilers. There is no port for VC++ compilers at this point.
This release has been tested successfully with:

- Linux i686, Fedora (Red Hat Linux 9), with gcc 3.3.2
- Linux i686, Mandrake 7, with gcc 2.95.2
- Solaris/SunOS 5.8
- Windows 2000, with MinGW compilers
- Windows 1998, with MinGW compilers

Others have compiled earlier versions of Galax on:

- Max OSX
- BSD Unix

### 2.1.2 Requirements

O'Caml
  If you are installing from the source, you will need the Objective Caml compiler version 3.07 or later. The Objective Caml compilers can be downloaded from: `http://caml.inria.fr/`.
Perl Compatible Regular Expression Library (PCRE)
  Galax requires the PCRE (Perl Compatible Regular Expression) Library version 4.5 or later. This comes standard on many Linux distributions or can be downloaded from: `http://www.pcre.org/`.
MinGW or Cygwin
  If your target platform is Windows, you will need to compile Objective Caml from its source under MinGW or Cygwin. These can be downloaded from: `http://www.mingw.org/` and `http://sourceware.cygnus.com/cygwin/`.
GNU Make
  The Makefiles for Galax require GNU make. If your Unix platform's default make, or the make in your default $PATH is not GNU make, then your need to make sure GNU make is installed on your system and use it instead.
GCC
  If you want to compile the C API, you will need a C compiler. Galax has only been tested with recent versions of gcc, so there is no guarantees it will work with anything else (although it has also been reported to work with Solaris standard compiler).
Java
  If you want to compile the Java API, you will need a recent JDK. Galax 0.4.0 has been tested with SUN Java 2, version 1.4. Earlier versions of Galax have been reported to work with IBM(R) Developer Kit Version 1.3.1 and Blackdown Java 4.1 (SDK 1.3).

## 2.2 Source-code Distribution

To build Galax from the source distribution: n

1. Select the configuration file.
   Copy the appropriate configuration file for your platform:
   Unix: `cp ./config/Makefile.unix ./config/Makefile`
   Windows: `cp ./config/Makefile.win ./config/Makefile`
2. Edit the configuration file `./config/Makefile` and set up your environment:
   Check the following required variables:
   OCAMLHOME
     Objective Caml library directory
   OCAMLBIN
     Objective Caml binaries
   GALAXHOME
     Where to install the Galax system once it has been compiled. Usually $(HOME)/Galax
   LIBPCRE
     Directory where libpcre.a (version 4.5+) is found. Usually /usr/lib or /usr/local/lib
   Check the following optional variables:
   ENCODINGS
     Default character set is UTF-8, if you want additional encodings, uncomment them.
   OPTTOOLS
     If you are compiling an optional tool, uncomment the optional tool. All other (unsupported) optional tools are listed in Makefile_opttools.conf
   APIS
     Uncomment the APIs, if you want to build them. The O'Caml API is compiled by default.
   CC
     If you want to compile the C API, you should set CC to the C compiler.
   JAVAHOME and JAVAINCLUDE
     If you want to compile the Java API, you should set JAVAHOME to your Java development kit and JAVAINCLUDE to the Java include directory.
3. Compile Galax: `make world`
4. Install Galax: `make install`
5. (Optional) Check installation: `make tests`

## 2.3 Binary Distribution

To install Galax, you should:

1. Uncompress the distribution:
   Windows: `unzip Galax-0.4.0-Win32.zip`
   Linux: `cat Galax-0.4.0-Linux.tar.gz | gunzip | tar xvf -`
   Solaris: `cat Galax-0.4.0-Solaris.tar.gz | gunzip | tar xvf -`
   The directory Galax/ should contain:
   README
     Pointer to documentation
   LICENSE
     Terms of software licence
   bin/
     Command-line tools
   doc/
     This documentation
   examples/
     Galax API examples for calling Galax from Caml, C and Java
   lib/
     Galax libraries
   usecases/
     XML Query Use Cases and XMark benchmark queries
2. Set up your environment:
   Set environment variable `GALAXHOME` to location of Galax/ directory.
   Add $(GALAXHOME)/lib/c:$(GALAXHOME)/lib/java to your LD_LIBRARY_PATH.
   Add $(GALAXHOME)/bin to your your PATH
3. Edit `examples/Makefile.config` and initialize variables:
   GALAXHOME
     The Galax directory. Usually $(HOME)/Galax
   OCAMLHOME
     If you are compiling O'Caml API example, the Objective Caml library directory.
   OCAMLBIN
     If you are compiling O'Caml API example, the Objective Caml binaries directory.
   LIBPCRE
     Directory where libpcre.a (version 4.5+) is found. Usually /usr/lib or /usr/local/lib.
   CC
     If you are compiling the C API example, the C compiler.
   JAVAHOME and JAVAINCLUDE
     If you are compiling the Java API example, you should set JAVAHOME to your Java development kit and JAVAINCLUDE to the Java include directory.
4. (Optional) Check installation:
   In $(GALAXHOME)/usecases execute: `make all`
   In $(GALAXHOME)/examples execute: `make all`

## 2.4 Website Interface

The Galax website and on-line demo is in the source distribution, only.

### 2.4.1 Prerequesites for demo website

The Galax website has only been tested with Apache Web server. We recommend you use Apache as some of the CGI scripts might be sensitive to the server you are using. Apache can be downloaded from: `http://www.apache.org/`

### 2.4.2 Installation of Website Interface

1. Edit `website/Makefile.config` and initialize variables:
   WEBSITE
     Location of the Apache directory for Galax.
   CGIBIN_PREFIX
     Prefix of directory that may contain CGI executables. If empty, then they are placed in WEBSITE.
2. Compile the the demo scripts: `make world`
3. Install the web site and demo scripts: `make install`
4. Configure your own Apache server: If all the galax demo files (HTML, XML and CGIs) are placed in one directory where the HTTP daemon is expecting to find them, then it is necessary to add the following config info to the `/etc/httpd/conf/http.conf` file:

         <Directory "/var/www/html/galax">
           Options All
           AllowOverride None
           AddHandler cgi-script .cgi
           Order allow,deny
           Allow from all
         </Directory>

   This permits scripts with suffix .cgi in `/var/www/html/galax` to be executed. The Galax demo is available at `http://localhost/galax`.
5. OR Configure an existing multi-user Apache server.
   Your sysadmin may already have set up an Apache server for general use, and allows CGI programs by any user. You can verify by finding directives similar to the following in httpd.conf (wherever it might be located on your system),

         <DirectoryMatch "^/home/[^/]+/cgi-bin">
           AllowOverride AuthConfig
           Options ExecCGI
           SetHandler cgi-script
         </DirectoryMatch>

   In that case, simply follow the comments in `website/Makefile.config` to choose installation destinations for your CGI programs and the HTML documents should suffice. The URL for accessing the installed site will depend on how your webserver is set up. Consult your sysadmin or webadmin for further help.