Installing PostgreSQL 7 on GNU/Linux and FreeBSD
PostgreSQL (pgsql for short) is the most advanced open source relational database server available. The number and type of options available can be daunting to the newbie as well as experienced database developer. This article will show you how to build and install pgsql from its source distribution available from http://www.postgresql.org. The current version of pgsql is 7.0.2 and comes packaged in a file named, surprisingly enough, postgresql-7.0.2.tar.gz.
For this article I used two systems to build pgsql, which are representative of the range of boxes used for development (though, probably not production) purposes. Their configurations are listed below:
System B: Dell Pentium III - 400, 64M, SCSI, FreeBSD 4.1
Both of these systems were base installs and no special steps were made to optimize performance.
Because pgsql runs on so many different systems, I chose to focus on two: GNU/Linux and FreeBSD. You will find that the process of installation is almost the same on both systems, except for a few steps at the end of the installation process.
Why Build Your Own?GNU/Linux distributions all come with some sort of package management utility. The same goes for FreeBSD with its ports collection. If installing pgsql is as simple as using RPM or changing directory into a Ports directory, why on earth would you choose to compile pgsql yourself?
As with everything in life, there are tradeoffs. Package managers trade in configuration options for ease of use. If you get the base pgsql RPM from a RedHat disc, what compile time options were specified? What directory is RPM going to install pgsql to? Where is the data going to be housed? You don't rightly know.
By building the sources yourself, you get complete control over how pgsql is compiled, where the data is going to be kept, and where the binaries are going to be installed.. You decide which compile time options are set as well as which support elements are included with the install.
It may be a good thing to rely on package managers for simpler apps, but when you're talking about server-level systems you want all the control you can muster. Especially when working in a 24/7 production environment.
Requirements: System & SoftwareWhen it comes to installation hardware, pgsql is a feature-packed but lean relational database system. Just to see if it could be done, I once compiled and installed an earlier version of pgsql on a RedHat 6.0 box with 1 gig of disk and 8 megs of RAM. Pgsql compiled and ran without complaint on that anemic little machine.
To quickly sum up hardware requirements, it's generally a safe bet to assume if you can install a modern GNU/Linux or FreeBSD distribution on a machine you should also be able to run pgsql. Deciding on a hardware configuration for a given workload is a black art and won't be discussed in this article short of the standard database server equation: As Much Ram as Possible + As Much Disk as Possible + As Much CPU as Possible.
To build pgsql you are required to have a base level of software installed on the machine. If you have a modern distribution of GNU/Linux or FreeBSD you can rest assured that you have everything needed to build pgsql. You may be missing a piece here and there depending on what options you choose when installing your distribution but everything needed to build pgsql will most likely reside on your chosen distribution's CD.
Unpacking the SourceLogged in as yourself (you need no special system privileges to build pgsql) and assuming you source tarball in your home directory type the following command to uncompress the file:
gunzip d postgresql*.gz ; tar xvf postgresql-7.0.2.tar
Once the command is completed you will have a directory named postgresql-7.0.2 within your home directory.
Page 1 of 3