1999-11-11 02:40:05 +00:00
|
|
|
Using PostgreSQL package in OpenBSD environment:
|
|
|
|
------------------------------------------------
|
|
|
|
|
|
|
|
If you are installing PostgreSQL for the first time, the following steps
|
|
|
|
required:
|
|
|
|
|
|
|
|
1. Create PostgreSQL user and group:
|
|
|
|
|
|
|
|
# adduser -batch pgsql "" "PostgreSQL pseudo-user" "*" \
|
|
|
|
-home /var -noconfig -group pgsql -shell nologin
|
|
|
|
|
|
|
|
2. Initialize PostgreSQL databases:
|
|
|
|
|
|
|
|
# install -d -o pgsql -g pgsql -m 755 /var/pgsql
|
|
|
|
# install -d -o pgsql -g pgsql -m 700 /var/pgsql/data
|
|
|
|
# pgwrap initdb
|
|
|
|
|
|
|
|
If you are upgrading PostgreSQL you don't need these steps. Read
|
2001-03-10 19:27:15 +00:00
|
|
|
!!PREFIX!!/share/doc/pgsql/INSTALL for more information on how to
|
1999-11-11 02:40:05 +00:00
|
|
|
upgrade your existing databases. See also `Special notes for OpenBSD
|
|
|
|
port' below.
|
|
|
|
|
|
|
|
If you wish to start PostgreSQL automatically during system startup,
|
|
|
|
add the following lines to /etc/rc.local:
|
|
|
|
|
2001-03-10 19:27:15 +00:00
|
|
|
if [ -x !!PREFIX!!/bin/pgwrap -a -x !!PREFIX!!/bin/postmaster ]; \
|
2000-05-23 16:31:41 +00:00
|
|
|
then
|
2001-03-10 19:27:15 +00:00
|
|
|
!!PREFIX!!/bin/pgwrap -o /var/pgsql/log \
|
2000-05-23 16:31:41 +00:00
|
|
|
pg_ctl -w -o "-i -S -o -F" start
|
1999-12-15 06:34:06 +00:00
|
|
|
echo -n ' pgsql'
|
1999-11-11 02:40:05 +00:00
|
|
|
fi
|
|
|
|
|
2001-03-10 19:27:15 +00:00
|
|
|
Don't forget to add !!PREFIX!!/lib/pgsql directory to shared libraries path in
|
1999-11-11 02:40:05 +00:00
|
|
|
/etc/rc.conf (if your architecture supports shared libraries):
|
|
|
|
|
2001-03-10 19:27:15 +00:00
|
|
|
shlib_dirs="!!PREFIX!!/lib/pgsql"
|
1999-11-11 02:40:05 +00:00
|
|
|
|
|
|
|
Please note that OpenBSD port of PostgreSQL requires a kernel compiled
|
|
|
|
with SYSVMSG, SYSVSEM and SYSVSHM options for proper operation.
|
|
|
|
The GENERIC kernel contains these options.
|
|
|
|
|
|
|
|
|
|
|
|
Special notes for OpenBSD port:
|
|
|
|
-------------------------------
|
|
|
|
|
|
|
|
OpenBSD port of PostgreSQL does NOT use shell startup files to
|
|
|
|
set up environment for postgres administrative programs (such as
|
|
|
|
initdb). This mean that you should use a wrapper program `pgwrap'
|
|
|
|
to run these programs instead of `su'. For example, you
|
|
|
|
should execute
|
|
|
|
# pgwrap initdb
|
|
|
|
instead of
|
|
|
|
# su -l pgsql -c 'exec initdb'
|
|
|
|
|
|
|
|
The `pgwrap' automatically sets up proper environment and permissions
|
|
|
|
for PostgreSQL programs. The syntax for `pgwrap' program is:
|
|
|
|
|
|
|
|
pgwrap [-n] [-o file] cmd [arg ...]
|
2001-02-22 19:28:12 +00:00
|
|
|
-n - Do not add PostgreSQL binary prefix to cmd.
|
|
|
|
-o file - Redirect stdout & stderr to file (write permissions
|
|
|
|
for PostgreSQL user required).
|
1999-11-11 02:40:05 +00:00
|
|
|
|
|
|
|
`pgwrap' automatically sets up the following environment variables:
|
|
|
|
|
|
|
|
System variables (these variables are always set to the following values):
|
|
|
|
|
2001-03-10 19:27:15 +00:00
|
|
|
PATH=!!PREFIX!!/bin:/bin:/usr/bin
|
1999-11-11 02:40:05 +00:00
|
|
|
USER=pgsql
|
|
|
|
LOGNAME=pgsql
|
|
|
|
SHELL=/bin/sh
|
|
|
|
HOME=/var/pgsql
|
|
|
|
|
|
|
|
PostgreSQL variables (these variables are set to the following values,
|
|
|
|
unless already set):
|
|
|
|
|
2001-03-10 19:27:15 +00:00
|
|
|
PGLIB=!!PREFIX!!/lib/pgsql
|
1999-11-11 02:40:05 +00:00
|
|
|
PGDATA=/var/pgsql/data
|
|
|
|
|
2001-03-12 13:09:52 +00:00
|
|
|
You must have root privileges to run `pgwrap'.
|
1999-11-11 02:40:05 +00:00
|
|
|
|