2. Installation

2.1. Download

pgSphere is not part of the PostgreSQL software. You can download it from the pgSphere homepage http://pgfoundry.org/projects/pgsphere/

2.2. Installation

You will need PostgreSQL 7.3 or above. We assume that you have PostgreSQL already compiled and installed. Please note: Depending on your system configuration mostly you have to be logged in as the system superuser.

There are two ways to compile pgSphere. The first is to copy the sources into the contribution directory of PostgreSQL's source tree (POSTGRESQL_SRC/src/contrib). Then, change into POSTGRESQL_SRC/src/contrib. If the sources are not yet installed and the directory pg_sphere does not exist, take the gzipped pgSphere sources ( e.g., pg_sphere_xxx.tgz ) and run:


shell> tar -xzf path/to/pg_sphere_xxx.tgz
            

Now, change into the pg_sphere directory and run :


shell> make
            

and to install pgSphere :


shell> make install
            

The second way does not require the PostgreSQL sources but the configuration tool pg_config.

First unpack the pgSphere sources:


shell> tar -xzf path_to_pg_sphere_xxx.tgz
            

Now, change into the pg_sphere directory and run:


shell> make USE_PGXS=1 PG_CONFIG=/path/to/pg_config
            

To install pgSphere you have to run :


shell> make USE_PGXS=1 PG_CONFIG=/path/to/pg_config install
            

To check the installation change into the pg_sphere source directory again and run:


shell> make installcheck
            

The check status will be displayed. Please note, the check gives different results with different PostgreSQL-versions. Currently, the check should run without errors with PostgreSQL-version 8.4. Otherwise check the file regression.diff.

2.3. Creating a database with pgSphere

We assume you have already created a database datab, where datab is the name of any database. Now change into the directory POSTGRESQL_INSTALL_PATH/share/contrib. Presupposing the name of your PostgreSQL's superuser is postgres type:


shell> psql -U postgres datab < pg_sphere.sql
            

Depending on your system, it may be necessary to give more psql options like port or host name. Please have a look at the PostgreSQL documentation for more details.