Sun Cluster Data Service for PostgreSQL Guide for Solaris OS

Installing the PostgreSQL Binaries in the Default Directory in a Zone (Alternative Installation)

The example instructions in Installing and Configuring PostgreSQL on Shared Storage in a Non-Global Zone install the PostgreSQL software on shared cluster storage. You can also install this software into the default directory /usr/local/pgsql by following the instructions in this section.

To install the PostgreSQL software in the default directory, perform the steps provided in the following example procedures:

ProcedureExample: Building and Installing the PostgreSQL Software in the Default Directory in a Zone

This example illustrates how to install the PostgreSQL software in the default directory /usr/local/pgsql. You can also build and install the PostgreSQL binaries on shared storage. See Installing and Configuring PostgreSQL on Shared Storage in a Non-Global Zone.

Before You Begin

You can only install the PostgreSQL software in the default directory if one of the following conditions is true:

If /usr/local/pgsql is linked to the global zone, create this directory in the non-global zone as well.

  1. Log in as the PostgreSQL user.


    zone-1# su - postgres
    
  2. Create the directory in the non-global zone.


    zone-1$ mkdir /pgsql-linksource
    
  3. Expand the software tar file.


    zone-1$ gzcat /tmp/postgresql-8.1.0.tar.gz |tar xvf -
    
  4. Add the C compiler and ar to your PATH.


    zone-1$ PATH=$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin
    zone-1$ export PATH
    
  5. Add the C compiler and readline libraries to your LD_LIBRARY_PATH.


    zone-1$ LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib:/opt/csw/lib
    zone-1$ export LD_LIBRARY_PATH
    
  6. Install the source and configure the build.


    zone-1$ gzcat /tmp/postgresql-8.1.0.tar.gz |tar xvf -  
    zone-1$ cd /global/mnt3/postgres/build/postgresql-8.1.0
    zone-1$ ./configure
    
  7. Build the PostgreSQL binaries.


    zone-1$ gmake
    

    If you use gcc to build the postgres binaries, build them in a failover file system.

  8. Run the PostgreSQL regression tests.


    zone-1$ gmake check
    
  9. Switch to the root user.


    zone$ su
    
  10. Add the C compiler and ar to your PATH.

    This example assumes the following:

    • The compiler is gcc, located in /usr/sfw/bin.

    • ar is located in /usr/ccs/bin.


    zone-1# PATH=$PATH:/usr/local/bin:/usr/sfw/bin:/usr/ccs/bin
    zone-1# export PATH
    
  11. Add the C compiler and readline libraries to your LD_LIBRARY_PATH.


    zone-1# LD_LIBRARY_PATH=/usr/sfw/lib:/usr/local/lib:/usr/lib:/opt/csw/lib
    zone-1$# export LD_LIBRARY_PATH
    
  12. Install the binaries.


    zone-1# gmake install
    
  13. Copy the binaries to the second node.


    zone-1# scp -rp /usr/local/pgsql phys-schost-2:/usr/local
    
  14. Exit from root access.


    zone-1# exit
    
  15. Clean the distribution.


    zone-1$ gmake clean
    
Next Steps

Perform the steps in Example: Enabling the PostgreSQL Software to Run in the Cluster to complete installation and configuration of PostgreSQL.