---------------------------- First time build and setup ---------------------------- 1) Set the following variables appropriately: export POSTGRE_INSTALLDIR= export POSTGRE_SRCDIR= cd ${POSTGRE_SRCDIR} 2) ./configure --prefix=${POSTGRE_INSTALLDIR} 3) gmake | tee gmake.out 4) gmake install | tee gmake_install.out 5) Set the following env. variables appropriately (as shown below): export LD_LIBRARY_PATH=${POSTGRE_INSTALLDIR}/lib:${LD_LIBRARY_PATH} export PATH=${POSTGRE_INSTALLDIR}/bin:${PATH} export PGDATA=${POSTGRE_INSTALLDIR}/data 6) create a new PostgreSQL database cluster: initdb -D ${PGDATA} Note: A database cluster is a collection of databases that are managed by a single server instance. 7) Run the postgres server: postmaster -D $PGDATA > logfile 2>&1 & 8) Create database: createdb test 9) Run the psql (client program): psql test 10) Stop the server: pg_ctl stop --------------------------------------- Connecting to a remote postgres server: --------------------------------------- *. psql client should be invoked in the following manner, if the postgres server is running on a different machine. psql test -h ------------------------------------- Executing a query from command line: ------------------------------------- psql test --command "" e.g: psql test --command "select * from ch_user;" ------------------------------------- Running a stand alone postgres ------------------------------------- postgres -D $PGDATA test