Sun Cluster Data Service for PostgreSQL Guide for Solaris OS

ProcedureExample: Building and Installing the PostgreSQL Software on Shared Storage in a Zone

This example illustrates how to install the PostgreSQL software on shared storage. You can also build and install the PostgreSQL binaries in the default directory /usr/local/pgsql. See Installing the PostgreSQL Binaries in the Default Directory in a Zone (Alternative Installation). Perform this procedure on phys-host-1 and phys-host-2.

  1. Log in to the zone.


    phys-schost-1# zlogin clu1
    
  2. Add the postgres user.


    zone-1# groupadd -g 1000 postgres
    zone-1# useradd -g 1000 -u 1006 -d /postgres -s /bin/ksh postgres
    zone-2# groupadd -g 1000 postgres
    zone-2# useradd -g 1000 -u 1006 -d /postgres -s /bin/ksh postgres
    
  3. Create the home directory for PostgreSQL user.


    phys-schost-1# mkdir /glohal/mnt3/postgres
    
  4. Change the ownership of the postgres directory.


    phys-schost-1# chown -R postgres:postgres /glohal/mnt3/postgres
    
  5. Log in as the PostgreSQL user.


    zone-1# su - postgres
    
  6. Set up the build environment.

    1. Create a build directory.


      zone-1$ mkdir build
      zone-1$ cd build
      
    2. 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
      
  7. Install the source and configure the build.


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


    zone-1$ gmake
    

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

  9. Run the PostgreSQL regression tests.


    zone-1$ gmake check
    
  10. Install the PostgreSQL binaries.


    zone-1# gmake install
    
  11. Clean the distribution.


    zone-1$ gmake clean