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

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

PostgreSQL

Posted Aug 21, 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.

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.



PostgreSQL Archives

Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 




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


















Thanks for your registration, follow us on our social networks to keep up-to-date