saada logo

 
  SAADA OVERVIEW
Home  
News  
Tutos and Links  
Download  
  Tutorial
Getting started  
Doing More  
SaadaQL  
The Web Interface  
VO Publishing  
Tips & Troubelshooting  
  COMMUNITY
Mailing List  
Saada Sites  
How to Contact us ?  
  DEVELOPER CORNER
Contributors  
Next Step  
Old Releases  
Inside Saada  
Using UWS  

 

SourceForge.net Logo


HOME ART > DEVELOPER CORNER > Old Releases > Saada 1.4.2 > TUTORIAL > Install Saada > Environment setup
Database Installation

SaadaDB needs an SQL data base to store data. The database management is not in charge of Saada but the operator.




In fact, Saada should work with any relational database system supporting SQL92.

However, all developements and tests have been achieved with PostgresQL 8.xx.

We advice to install this DBMS to run Saada. Note that PostgresQL works fine on Linux Mac and Windows platforms.

Postgresql binaries can be downloaded at postgresql.org. If you build Postgres from sources, configure it with the Java enable option. Options are given by « ./configure —help » command at the distribution root.

Usually the Postgres system is owned by a postgres user in charge of the system administration. The PostgresQL system contains a special database containing all metadata related to this task. This database is named postgres and it is of course owned by the user postgres.

Tips given below are based on this classical user configuration. Any other setup can be figured out except running the Postgres server as root. Notice that this configuration supposes (at least on Linux) you to know the root password. If you want to replace the postgres with another, just change it in the text below. This user issue is hidden on Windows platforms. We suppose here that yur current account is saadaop.

 If there is no Postgres database system available on your machine, you must start with initializing it.
- Select the directory where you want to install your databases (/var/psql by delault on Linux) and initialize the system (e.g. /your/database/directory).
- Init your database system

    • saadaop@host% sudo -u postgres initdb -D /your/database/directory

The root password will be prompted here.

 You can now run the databse server and try the connection.

    • saadaop@host% sudo -u postgres pg_ctl -D /your/database/directory -l /your/database/directory/postmaster.log start

If the server doesn’t start, look at the /your/database/directory/pgstartup.log. Otherwise, you are ready to try a connection :

    • saadaop@host% sudo -u postgres psql

      Welcome to psql 8.2.1, the PostgreSQL interactive terminal.

      Type:  \copyright for distribution terms
            \h for help with SQL commands
            \? for help with psql commands
            \g or terminate with semicolon to execute query
            \q to quit

      postgres=#

psql is the interactive client of PostgreSQL. You will no longer need it with Saada.

 To avoid security restrictions, you can start by authorizing any local users to connect the database. This low security level is acceptable to begin with Saada. It can be more restrictive once the database is in operation. Refer to the Postgres documentation.

    • Shut down the server : saadaop@host% sudo -u postgres pg_ctl -D /your/database/directory stop
    • edit the file /your/database/directory/pg_hba.conf as follow
      # TYPE  DATABASE    USER   CIDR-ADDRESS   METHOD
      # "local" is for Unix domain socket connections only
      local   all         all           trust
    • Restart the server : saadaop@host% sudo -u postgres pg_ctl -D /your/database/directory -l /your/database/directory/postmaster.log start
    • try a connection as postgres user on the database postgres :
      saadaop@host% psql -U postgres postgres
      Welcome to psql 8.2.1, the PostgreSQL interactive terminal.

      Type:  \copyright for distribution terms
            \h for help with SQL commands
            \? for help with psql commands
            \g or terminate with semicolon to execute query
            \q to quit

      postgres=#

This step must succeed before to continue. In case of failure, check again each all items.

 You need now to grant to the user saadaop the permission of creating databases.

- Connect the database postgres as postgres user

    • postgres@host% psql -U postgres postgres

- Create an appropriate role for the Saada operator (e.g. saadaop)

    • postgres=> CREATE ROLE saadaop CREATEDB SUPERUSER; Don’t forget the ’ ;’ !!
    • postgres=>\q

- Test database creation and deletion

    • Logon as saadaop
    • Database creation : saadaop@host% createdb TEST
    • Database connection : saadaop@host% psql TEST
    • Database deletion : saadaop@host% dropdb TEST

 Check that you can run posgtres from the shell. The Postgres shell displays the version number at starting time. Check that this number matches the installed version but not a previous one (frequent issue with Linux).
- Check shell variables (Windows) Open the shell variable editor, menu Start>Configuration>System>Advand ced>Environment variables

Check that the variables PGDATA, PGHOME and PGHOST are correclty set. Ckas aslo that the PATH variable include a pointer on PGHOME\bin (see figure above)
- On Linux platform, include the $PGHOME/bin in your path.

If all these operations succeeded, you can go ahead with Saada. Otherwise, refer to the administration guide of Postgres

last update 2007-05-31