Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum Rss Feed

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Rss Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles


Posted Aug 22, 2003

PostgreSQL Software Installation

By James Koopmann

Getting free software and installing can sometimes be a daunting task. Not so with PostgreSQL.

Get the software

The biggest choice you have when getting the software is the version you want and the machine type you need to install on. As far as machine type, you really only have a choice of a Unix or Windows platform. Depending on the platform, you will need to go to either of two places for download.


Getting the PostgreSQL software is only a few clicks away. If you are installing to a UNIX operating system, go to http://advocacy.postgresql.org/download/ and pick the form you wish. This will pull the latest and greatest version for you. If you want to get an earlier version, you should go to http://www.postgresql.org/mirrors-ftp.html, select one of the mirrors and then choose a version from the source tree. You should end up with a compressed tar-ball named something similar to postgresql-7.3.4.tar.gz. 


Running PostgreSQL on a windows machine is not as difficult as some would think. All you really need to do is go to http://cygwin.com/ and get the Linux-like operating system with all the tools with which UNIX users are familiar. You must first download the setup executable http://cygwin.com/setup.exe and then run it from windows. This will prompt you for all packages available along with the PostgreSQL database system.

Install the Software

Installation of the software is quite different depending on the operating system platform.

Unix Installation Steps

Installation on a UNIX platform reminds me of the old days when I was installing Oracle. There was a tar-ball and some manual configuration that needed to be done. It is a far cry from the GUI installation but the steps involved are quite minimal and just about anyone can follow them.





Create Postgres user

Create a Postgres user to manage the software. I named this user postgres


cp postgresql-7.3.4.tar.gz.tgz /usr/local/src

copy the downloaded tar-ball to the /usr/local/src directory


cd /usr/local/src

change to the /usr/local/src directory where you put the tar-ball


unzip postgresql-7.3.4.tar.gz.tgz

decompress the tar-ball


tar -xvf postgresql-7.3.4.tar.gz.tar

Extract the PostgreSQL source tree


chown -R postgres.postgres postgresql-7.3.4

Change the owner of the postgres source tree to the postgres user


su - postgres

Login as the postgres user to configure and compile


cd postgresql-7.3.4

Change to the root node of the PostgreSQL source tree


./configure --with-perl

Run the configure command to set up the source tree for the options you want to install. Here I am configuring with the perl option. See documentation for other options. If you want to run multiple configure commands make sure you use the 'gmake clean' command before issuing the configure command.


gmake check

Runs regression checks on your configuration to verify the configuration.



Runs the build procedures and compiles for what you have configured


su - root

Login as root


gmake install

Install your configuration


chown -R postgres.postgres /usr/local/pgsql

Change the permissions on the PostgreSQL binary


vi /etc/profile

Modify the environment variables for everyone



Set the library path


export PATH

Set the path for binaries


export MANPATH

Set the path to the man pages

psql --version

Test to make sure you can find the binaries. Should get something like: psql (PostgreSQL) 7.3.4

Windows Installation Steps

Many people believe that the installation of PostreSQL on a windows platform is difficult because PostreSQL was written for a UNIX environment. They feel the difficulty stems from the fact that they need to first put a Unix-like clone environment on their Windows box, and then obtain all the necessary packages, and string them together somehow. While you do need to install some form of Unix-like environment on top of Windows, it really is not hard and I believe that most will enjoy the GUI like nature of this installation over the UNIX type previously presented. To begin the installation process, run the setup.exe that you downloaded from the windows section of getting the software previously in this article.  The following screen shots represent a typical Cygwin setup.

PostgreSQL Archives

Latest Forum Threads
Postgresql Forum
Topic By Replies Updated
Creating a Table Where Date has to be Now OR Future Shadowayara 1 June 6th, 03:56 PM
Streaming Replication on a Single Database lbergeson 0 January 30th, 03:19 PM
Error - SQL state: 22P02 raj_db 1 December 20th, 08:30 AM
Searching in multi-dimensional array fields hdany 0 December 1st, 06:46 AM