PostgreSQL Software Installation

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.

Unix

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. 

Windows

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.

Step

Command

Description

1

Create
Postgres user

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

2

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

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

3

cd
/usr/local/src

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

4

unzip
postgresql-7.3.4.tar.gz.tgz

decompress the
tar-ball

5

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

Extract the
PostgreSQL source tree

6

chown -R
postgres.postgres postgresql-7.3.4

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

7

su – postgres

Login as the
postgres user to configure and compile

8

cd
postgresql-7.3.4

Change to the
root node of the PostgreSQL source tree

9

./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.

10

gmake check

Runs regression
checks on your configuration to verify the configuration.

11

gmake

Runs the build
procedures and compiles for what you have configured

12

su – root

Login as root

13

gmake install

Install your
configuration

14

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

Change the
permissions on the PostgreSQL binary

15

vi
/etc/profile

Modify the
environment variables for everyone

 

LD_LIBRARY_PATH=/usr/local/pgsql/lib

export
LD_LIBRARY_PATH

Set the
library path

 

PATH=/usr/local/pgsql/bin:$PATH

export PATH

Set the path
for binaries

 

MANPATH=/usr/local/pgsql/man:$MANPATH

export MANPATH

Set the path
to the man pages

16

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.

James Koopmann
James Koopmann
James Koopmann has fourteen years of database design, development and performance tuning experience. In addition, he has extensive database administration experience in Oracle and other relational databases in production environments, specializing in performance tuning of database engines and SQL based applications. Koopmann is an accomplished author with several technical papers in various Oracle related publications such as Oracle Magazine, Oracle Professional and SQL>UPDATE_RMOUG. He is a featured author and database expert for DatabaseJournal, a member of the editorial review committee for Select Journal (The Magazine for the International Oracle Users Group), an Oracle Certified Professional DBA and noted speaker at local Oracle User Groups around the country.

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles