PostgreSQL is now one of the best opensource database options and has support
for various operating systems (multiple platforms).
Here it is assumed that the existing database on a server that is installed
postgresql-8.1.6, because of the need for development will be installed
postgresql-9.1.0-1.
Preparation
First, download source on postgres website (www.postgresql.org)
For windows: postgresql-9.1.0-1-windows-binaries (32 bit)
postgresql-9.1.0-1-windows-x64-binaries (64 bit)
For Linux: postgresql-9.1.0-linux-one-binaries.tar (32 bit)
postgresql-9.1.0-1-linux-x64-binaries.tar (64 bit)
Source: posqtgresql-9.1.0.tar.bz2
Multiple Postgres install on windows
Extract or double-click postgresql-9.1.0-1-windows-binaries (adjust with os
version 32 or 64 bit), here will be the resultant pgsql directory.
Pgsql Move to the directory that you want, for example in the program files, or
the directory where you installed postgres already exists, we assume pgsl in
place in d:\Postgres\pgsql.
Then create a data directory in pgsql, and use the command line (cmd) go to
the directory d:\Postgres\pgsql\bin, type:
Initdb -U postgres -D d:\Postgres\pgsql\data
Here will be created in the database structure in the data directory.
After completion don’t run the pg_ctl, because we know by default postgresql
running on port 5432, open first postgresql.conf (d:\Postgres\pgsql\data\
postgresql.conf) and change the port to 5433.
for pg_hba.conf (d:\Postgres\pgsql\data\pg_hba.conf) adjust as needed, or you
just let the default if you run postgres on localhost only.
Open postgresql.conf, uncomment and adjust the following configuration:
port = 5433
max_connections = 100
log_destination = 'stderr'
logging_collector = on
log_directory = 'pg_log'
log_filename = 'postgresql-% Y-% m-% d_% H% M% S.log'
run postgres, from the directory d:\Postgres\pgsql\bin, type:
d:\Postgres\pgsql\pg_ctl -D d:\Postgres\pgsql\data -U postgres start
to turn it off:
d:\Postgres\pgsql\pg_ctl -D d:\Postgres\pgsql\data -U postgres stop
To make it easier when I want to run on and off, enter the command into
notepad and save it in a bat file, for example: startup.bat and shutdown.bat
Tip's for Windows XP Home:
Sometimes the system is WinXP Home edition installed postgres user is not
considered when installing postgres supersuer 9.1, doing this is:
At the command prompt, enter the bin directory in postgres 9.1
d:\Postgres\pgsql\bin> psql -d postgres
# Alter role postgres with superuser;
ALTER ROLE
# Alter user postgres with login (if postgres can not log in)
ALTER ROLE
Install Multiple Postgres on Linux Fedora
Create a directory for postgres 9.1
For example: # mkdir /usr/local/pgsql-9.1
(Postgres 8.1 is assumed in the directory /usr/local/pgsql)
Say positions postgres file in /usr/local/pgsql-9.1
# cd /usr/local/pgsql-9.1
# tar -xf postgresql-9.1.0-linux-one-binaries.tar (binary file)
# tar jxfv posqtgresql-9.1.0.tar.bz2 (source file)
# mkdir data
# chown-R postgres:postgres *
# su postgres
$ /usr/local/pgsql-9.1/bin/initdb -U postgres -D /usr/local/pgsql-9.1/data
As in Windows change in the postgresql.conf configuration first,
then start postgresql.
So postgresql running on different ports ie 5432 and 5433
Regards,