release notes | Book: 1.9.5, 1.9.12 (opt, FHS), 2.11 (FHS), 2.12 (FHS), 2.13 (FHS), 2.14 (FHS), | Wiki | Q&A black_bg
Web: Multi-page, Single page | PDF: A4-size, Letter-size | eBook: epub black_bg

Installing a PostgreSQL Server

The preferred way to set up a PostgreSQL server should be the installation of the version provided by your OS distribution. It is strongly recommended to use version 8 or higher.

Install the PostgreSQL server, client and JDBC support with the tools of the operating system. You can download a suitable package from http://www.postgresql.org/ftp/. A version that is suitable for current versions of Scientific Linux 3 can be found at http://www.postgresql.org/ftp/binary/v8.1.0/linux/rpms/redhat/rhel-es-3.0/.

Initialize the database directory (usually /var/lib/pgsql/data/), start the database server, and make sure that it is started at system start-up. This may be done with

[root] # /etc/init.d/postgresql start
[root] # chkconfig postgresql on

If the start-up script does not perform the initialization automatically, it might have to be done with

[root] # initdb -D /var/lib/pgsql/data/

and the server is started manually with

[root] # postmaster -i -D /var/lib/pgsql/data/ >logfile 2>&1 &

The server has to be configured to admit TCP/IP connections from localhost. This is the default for version 8 of PostgreSQL.

For dCache version 1.6.6 release 1, please make sure the file /var/lib/pgsql/data/postgresql.conf contains

...
add_missing_from = on
...

This will not be necessary in future releases.

The file /var/lib/pgsql/data/pg_hba.conf should contain

...
local   all         all                        trust
host    all         all         127.0.0.1/32   trust
host    all         all         ::1/128        trust

Restart the server, e.g. with

[root] # /etc/init.d/postgresql restart

The configuration of the access rights in /var/lib/pgsql/data/pg_hba.conf is rather liberal: Any user on the local machine may connect to the PostgreSQL server as any database user without specifying a password. This way, you can be sure that problems will not be due to wrong access rights or passwords. See the section called “Configuring Access to PostgreSQL of the dCache book for more advice on configuring PostgreSQL.

If a current version of PostgreSQL is not available for the distribution, it can be compiled as follows: You can download the source code from the official web site: http://www.postgresql.org/download and build it following the instruction: http://www.postgresql.org/docs/8.0/static/installation.html Here is a short version from that page:

[root] # ./configure --prefix=/usr/local/pgsql
[root] # gmake
[root] # su
[root] # gmake install
[root] # adduser postgres
[root] # mkdir /usr/local/pgsql/data
[root] # chown postgres /usr/local/pgsql/data
[root] # su - postgres
[root] # /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
[root] # /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data > logfile 2>&1 &
[root] # /usr/local/pgsql/bin/createdb test
[root] # /usr/local/pgsql/bin/psql test

If there is another PostgreSQL installed on your machine, make sure root’s path is set so that executables, esp. psql, postmaster, and pg_ctl, are called from the V8.x.x PostgreSQL that you intend to use for dCache. (You will be doing most of this as root). Another thing is to make sure that the various libpg.so libraries are not invoked from the other PostgreSQL distribution. locate libpg.so will show which ones are on your system. Set LD_LIBRARY for root to insure that the pnfs PostgreSQL libs are seen first!