Installing VMware Postgres

This topic describes how to download and install or upgrade components of the VMware Postgres software distribution. The VMware Postgres software components are provided in 4 downloadable packages:

  • Postgres Server RPM – installs or upgrades all server and client components. This includes the PostgreSQL database, pgBackRest, pg_auto_failover, psql, and the ODBC driver.
  • Postgres Clients RPM – installs or upgrades only the client components, psql and the ODBC driver.
  • JDBC Driver for VMware Postgres – provides only the JDBC driver as a compressed ZIP file. This can be used on any machine as necessary for developing Java clients to PostgreSQL.
  • VMware Postgres Extensions – installs the RPM packages for VMware Postgres PL/Java, VMware Postgres PL/R, and PostGIS.

Prerequisites

  • Your deployment systems must meet the system requirements described in Supported Platforms.
  • You must have root permissions to install or upgrade the software.
  • Ensure that you have not installed Red Hat Enterprise Linux PostgreSQL on any system where you want to install VMware Postgres Server or VMware Postgres Clients. VMware Postgres software cannot be installed alongside RHEL PostgreSQL at this time.
  • The VMware Postgres PL/Java Extension requires a Java development kit to be installed. The extension is tested with OpenJDK 1.8.0. See Installing the VMware Postgres PL/Java Extension.
  • The VMware Postgres PL/R Extension requires R to be installed before the RPM can be installed. See Installing the VMware Postgres PL/R Extension.

Installing the Postgres Server RPM

Perform this procedure on each host that will run VMware Postgres. Note that this process also installs the psql and ODBC driver client components to each machine:

  1. Download the VMware Postgres Server RPM distribution from VMware Tanzu Network. The Postgres Server download filename has the format: vmware-postgres-<postgres-version>-<vmware-version>.<platform>.<architecture>.zip, for example vmware-postgres13-13.4.0.el7.x86_64.zip.

  2. Log in to your system as root, or use sudo in the next step to acquire root privileges.

  3. Navigate to the downloaded RPM file and install it using the yum utility. For example:

    $ cd ~/Downloads/vmware-postgres-13
    $ yum install ./vmware-postgres13-13.4-0.el7.x86_64.rpm
    
  4. The VMware Postgres RPM installation creates the postgres user and sets the PGDATA and PATH environment variables in ~postgres/.bash_profile. It also creates the directory /var/lib/pgsql/data, owned by the postgres user, which you can specify for the data directory when you initialize your PostgreSQL instance. This example initializes the data directory:

    # su --login postgres
    $ source ~/.bash_profile
    $ initdb -D /var/lib/pgsql/data
    
  5. If you are creating a High Availability configuration, you will create the required Postgres instances as part of the pg_auto_failover setup. For more details refer to Creating a High Availability cluster.

  6. If you are creating a single non-HA Postgres server, start it by running:

    $ postgres -D /var/lib/pgsql/data >/var/lib/pgsql/data/logfile 2>&1 &
    
  7. Continue the PostgreSQL server setup, as described in Server Setup and Operation in the PostgreSQL documentation.

  8. Follow the instructions in Configuring and Using VMware Postgres to configure PostgreSQL with pgBackRest, psqlODBC, and pgjdbc.

Installing the VMware Postgres Client RPM

Perform this procedure on each host that will act only as a client to the VMware Postgres instance.

Important: Do not install the client package on any machine that has a PostgreSQL server.

  1. Download the Postgres Clients RPM distribution from [VMware Tanzu Network]https://network.pivotal.io). The download filename has the format: vmware-postgres-clients-<postgres-version>.<vmware-version>.<platform>.<architecture>.zip.

  2. Log in to your system as root, or use sudo in the next step to acquire root privileges.

  3. Navigate to the downloaded RPM file and install it using the yum utility. For example:

    $ cd ~/Downloads/vmware-postgres-13
    $ yum install ./vmware-postgres13-clients-13.4-0.el7.x86_64.rpm
    

Installing the VMware Postgres JDBC Driver

  1. Download the VMware Postgres Postgres Clients for RHEL7 from VMware Tanzu Network. The JDBC driver file name inside the zip file has the format: vmware-postgres-jdbc-<jdbc-version>.jar.

  2. Unzip the downloaded file to obtain the driver JAR file. For example:

    $ unzip vmware-postgres<version>-clients-<version>-0.el7.x86_64.zip
    
  3. The JDBC driver JAR is not installed at the system level; simply include it in your Java CLASSPATH as necessary to connect using the driver. See Setting up the Class Path in the JDBC Driver documentation for more information.

Installing the VMware Postgres Extensions

The VMware Postgres Server and Extensions download from VMware Tanzu Network includes RPM packages for VMware Postgres PL/Java, VMware Postgres PL/R, Orafce, and PostGIS. Follow these steps to download and install these extensions.

On the Postgres server, extract the RPM packages from the Extensions for VMware Postgres Server download file.

$ unzip vmware-postgres-extensions-<postgres-version>.<platform>.zip

To install the extensions see PL/Java, PL/R, and PostGIS.

PL/Java

  1. Install the PL/Java extension RPM.

    $ sudo yum install -y ./vmware-postgres<version>-pljava-extension-<postgres-version>.<platform>.rpm
    
  2. Install a JDK. The VMware PL/Java extension is tested with Java OpenJDK 1.8.0. The following steps presume you are using this JDK.

    $ sudo yum install java-1.8.0-openjdk-devel
    
  3. Run the PL/Java jar file to install libraries and extension files.

    # JAVA_HOME=/usr/lib/jvm/java
    # java -Dpgconfig.sharedir=/usr/share/postgresql \
        -Dpgconfig.pkglibdir=/usr/lib64/postgresql \
        -jar /usr/share/postgresql/extension/pljava-*.jar
    
  4. The following commands create the PL/JAVA extension in a Postgres database.

    # su postgres
    $ psql test
    #= set pljava.libjvm_location TO '/lib/jvm/jre/lib/amd64/server/libjvm.so';
    #= CREATE EXTENSION pljava;
    

See the PL/Java project information site for information about using PL/Java.

PL/R

  1. Install R from the EPEL repo before you install the VMware Postgres PL/R RPM.

    $ sudo yum install epel-release
    $ sudo yum install R
    
  2. Install the PL/R extension.

    $ sudo yum install vmware-postgres<version>-plr-extension-<postgres-version>.<platform>.rpm
    
  3. Enable the PL/R extension in each Postgres database where it will be used. For example, these commands register the PL/R language in the database named test.

    # su postgres
    $ psql -d testdb -c 'CREATE EXTENSION plr;'
    

See PL/R Project for more about PL/R. See The R Project for Statistical Computing for information about available R packages.

PostGIS

Follow these steps to install the VMware Postgres PostGIS RPM. The sequence is important. You must install the PostGIS RPM before you install the gdal and gdal-devel packages.

  1. Install the VMware Postgres PostGIS RPM.

    $ sudo rpm -ivh --no-deps vmware-postgres<version>-postgis-extension-<postgres-version>.<platform>.rpm
    
  2. Install the epel-releasepackage.

    $ sudo yum install -y epel-release
    
  3. Create the PostGIS extension in each database where you want to use PostGIS. Note: Do not install the extension in the postgres database.

    # su postgres
    $ createdb testdb
    $ psql -d testdb -c 'CREATE EXTENSION postgis;'
    

See the PostGIS web site for information about using PostGIS.