|

|
 | Virtual Server Documentation |
Home | Getting Started | FreeBSD | Solaris | Handbook
Installing PostgreSQL
To install PostgreSQL on your Virtual Server,
connect to your Virtual Server via
Telnet or SSH
and follow the instructions below.
-
Install the PostgreSQL software by doing the following,
according to your Virtual Server O/S.
-
FreeBSD & Solaris PostgreSQL 7.0.3
Run this command:
% vinstall pgsql
The PostgreSQL installation includes all the necessary
PostgreSQL files, initializes a database with the same name as your user
name, and activates the postmaster daemon.
Several wrapper scripts are available for all PostgreSQL commands.
The wrapper scripts are automatically created when PostgreSQL is
installed.
PostgreSQL is installed in a version-specific directory
(~/usr/local/pgsql-7.X.X) and a symlink named pgsql
is created that points to that directory.
-
BSD/OS Upgrade! PostgreSQL 6.5.3
Run this command:
% installpgsql
This installation program installs all the necessary PostgreSQL files and
initialize a database with the same name as your Virtual Server user name.
It also starts the PostgreSQL daemon.
-
Huh?
If you don't know the Virtual Server O/S, try the following:
-
To restore your data using the new psql client, type this:
% psql -d template1 -f outputfile
Configuration
To configure PostgreSQL (which is optional), add the following lines to your shell startup file,
according to which shell your Virtual Server is running.
|
NOTE:
To find out which shell your Virtual Server is running, type:
% echo $SHELL
|
-
/bin/csh
If you are using /bin/csh or one of its variants, then add the following
lines to the ~/.cshrc file on your Virtual Server:
setenv PGDATA /usr/local/pgsql/data
setenv PGLIB /usr/local/pgsql/lib
set path = (/usr/local/pgsql/bin $path)
-
/bin/sh & /bin/bash
If you are using the Bourne shell (/bin/sh or /bin/bash) then add the following
lines to the ~/.profile file on your Virtual Server:
PATH=$PATH:/usr/local/pgsql/bin
PGDATA=/usr/local/pgsql/data
PGLIB=/usr/local/pgsql/lib
export PGDATA PGLIB
The psql Client
The main tool for using PostgreSQL is the psql client.
To start psql use this command:
% psql
The psql client will start up and you will be able to type in
SQL code and ask for help.
|
NOTE:
You may see the following error:
Connection to database '(null)' failed.
FATAL: PQsetdb: Unable to determine a Postgres username!
To resolve this, simply use the following command:
% vpwd_mkdb ~/etc/passwd
This program will read your
password file at ~/etc/passwd and create a Berkeley DB format file.
PostgreSQL uses this new file to look up user names and account information.
|
Removing PostgreSQL
To remove PostgreSQL from your Virtual Server,
connect to your Virtual Server via
Telnet or SSH
and do the following:
-
Remove the PostgreSQL software by running the commands that match your
Virtual Server O/S.
-
FreeBSD & Solaris PostgreSQL 7.0.3
Run this command:
% vuninstall pgsql
-
BSD/OS Upgrade! PostgreSQL 6.5.3
Run these commands:
% cd ~/usr/local
% chmod -R u+w pgsql
% rm -rf pgsql
-
Huh?
If you don't know the Virtual Server O/S, try the following:
-
Next, edit your ~/etc/rc file, removing the line that contains postmaster.
-
Then run the ps command, like this:
% ps -x
Determine the process ID of the PostgreSQL daemon and use kill to stop
the PostgreSQL daemon:
% kill PROCESS-ID
|