The use of the PostgreSQL environment variables is not required. However, they are helpful when performing tasks
within PostgreSQL, including starting and shutting down the
postmaster
processes. The environment
variables that should be set are for the
man
pages and the
bin
directory. You can
do so by adding the following statements into the
/etc/profile
file. This should work for any
sh
-based shell, including bash and ksh.
PATH=$PATH:/usr/local/pgsql/bin
MANPATH=$MANPATH:/usr/local/pgsql/man
export PATH MANPATH
Note: You must login to the system
after
the
/etc/profile
file has had
environment variables added to it in order for your shell to utilize them.
Depending on how your system handles shared libraries, you may need to inform the operating system of where your
PostgreSQL shared libraries are located. Systems such as Linux, FreeBSD, NetBSD, OpenBSD, Irix, HP/UX, and Solaris will
most likely not need to do this.
In a default installation, shared libraries will be located in
/usr/local/pgsql/lib
(this may be
different, depending on whether you changed it with the
--prefix
configuration option). One of the
most common ways to accomplish this is to set the LD_LIBRARY_PATH environment variable to
/usr/local/pgsql/lib
. See Example 2-13 for an example of doing this in
Bourne-style shells and Example 2-14 for an example of doing this in
csh
and
tcsh
.
Example 2-13. Setting LD_LIBRARY_PATH in a bash shell
$
LD_LIBRARY_PATH=/usr/local/pgsql/lib
$
export LD_LIBRARY_PATH
Example 2-14. Setting LD_LIBRARY_PATH in csh and tcsh
$
setenv LD_LIBRARY_PATH /usr/local/pgsql/lib