When you have acquired the source for PostgreSQL you are going to compile, you will wish to copy the PostgreSQL source package to a temporary folder. This folder will be the path where you will install and configure PostgreSQL. Within this path you will extract the contents from the tar.gz file and proceed with the installation.
Bear in mind that this will not be the installation location. This is a temporary location for configuration and compilation of the source package itself. If you have downloaded the PostgreSQL package from the web, it is most likely not saved in the correct path (unless you explicitly chose to save there). A common convention for building source on UNIX and Linux machines is to build in the /usr/local/src path. You will most likely need root access in order to access this path. As such, the remaining examples in this chapter will involve the root user unless otherwise specified.
If you are a user of a commercial Linux distribution, we strongly suggest you verify whether or not you have PostgreSQL already installed. On a RPM based systems such as SuSe, Mandrake or RedHat this can be done by using the following command: rpm -qa | grep -i postgres . If you do have PostgreSQL pre-installed, there is a good chance that it is outdated. You will want to install at least PostgreSQL 7.1.2.
You can remove rpm packages using the rpm -e command.
Here is an example of unpacking the source on your system:
Example 2-5. Unpacking the PostgreSQL Source Package
[root@host root]# mv postgresql-7.1.2.tar.gz /usr/local/src [root@host root]# cd /usr/local/src [root@host src]# tar xzvf postgresql-7.1.2.tar.gz postgresql-7.1.2/ postgresql-7.1.2/ChangeLogs/ postgresql-7.1.2/ChangeLogs/ChangeLog-7.1-7.1.1 postgresql-7.1.2/ChangeLogs/ChangeLog-7.1RC1-to-7.1RC2 postgresql-7.1.2/ChangeLogs/ChangeLog-7.1RC2-to-7.1RC3 postgresql-7.1.2/ChangeLogs/ChangeLog-7.1RC3-to-7.1rc4 postgresql-7.1.2/ChangeLogs/ChangeLog-7.1beta1-to-7.1beta3 postgresql-7.1.2/ChangeLogs/ChangeLog-7.1beta3-to-7.1beta4 postgresql-7.1.2/ChangeLogs/ChangeLog-7.1beta4-to-7.1beta5 postgresql-7.1.2/ChangeLogs/ChangeLog-7.1beta5-to-7.1beta6 postgresql-7.1.2/ChangeLogs/ChangeLog-7.1beta6-7.1RC1 postgresql-7.1.2/ChangeLogs/ChangeLog-7.1rc4-7.1 postgresql-7.1.2/ChangeLogs/ChangeLog-7.1.1-7.1.2 postgresql-7.1.2/COPYRIGHT [...]
For references purposes, the following list is a description of the tar options we are using to extract the PostgreSQL source distribution.
x (extract) - tar will extract from the passed filename (as opposed to creating a new file). The "v" and "z" parameters to the tar command mean:
v (verbose) - tar will print verbose output as files are extracted. You may omit this flag if you do not wish to see each file as it is unpacked.
z (zipped) - tar will use gunzip to decompress the source (this assumes that you are using the GNU tools; other versions of tar may not support the "z" flag, which requires that the file be unzipped manually with gunzip , or a compatible unzip application, which creates a ".tar" file to be unpacked by tar without the "z" flag).
The use of the z flag within tar may not work if you are not using the GNU version of tar. In this case you would have to use use gzip -d to decompress the tgz file before using tar to extract them.
f (file) - , tar will using the filename following the "f" parameter to determine which file to extract. In our case, postgresql-7.1.2.tar.gz .
After you have completed the extraction of the file files, you will need to change into the newly created path (e.g., /usr/local/src/postgres-7.1.2 ), as the remaining installation steps will take place in the directory where you extracted the PostgreSQL source.