Installing or Upgrading 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 3 downloadable packages:

  • Postgres Server RPM – installs or upgrades all server and client components. This includes the PostgreSQL database, pgBackRest, Patroni, 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.

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>.rpm.

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

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

    $ cd ~/Downloads
    $ yum install vmware-postgres-11.7.1.el7.x86_64.rpm
    
  4. If you are upgrading a running Postgres Server, restart the server. For exmple:

    $ su postgres
    $ pg_ctl restart
    
  5. If you are installing a new Postgres Server, continue to set up and start the server, as described in Server Setup and Operation in the PostgreSQL documentation.

  6. Follow the instructions in Configuring and Using VMware Postgres to configure PostgreSQL with pgBackRest, Patroni, 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.

Note: The VMware Postgres Client package is not required on Postgres Server machines, and you cannot install the client package on any machine that has a PostgreSQL server.

  1. Download the VMware Postgres Client RPM distribution from VMware Tanzu Network. The download filename has the format: vmware-postgres-clients-<postgres-version>.<vmware-version>.<platform>.<architecture>.rpm.

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

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

    $ cd ~/Downloads
    $ yum install vmware-postgres-clients-10.10.3.el7.x86_64.rpm
    
  4. Continue to set up and start the PostgreSQL server, as described in Server Setup and Operation in the PostgreSQL documentation.

    The VMware Postgres RPM installation creates the postgres user and sets the PGDATA environment variable 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 and starts the server:

    # su postgres
    $ source ~/.bash_profile
    $ initdb -D /var/lib/pgsql/data
    $ pg_ctl start -D /var/lib/pgsql/data -l /var/lib/pgsql/data/logfile
    

Installing the VMware Postgres JDBC Driver

  1. Download the VMware Postgres JDBC driver software distribution from VMware Tanzu Network. The JDBC driver download file name has the format: vmware-postgres-<postgres-version>-jdbc-driver.zip.

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

    $ unzip vmware-postgres-10.10.3-jdbc-driver.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 Extensions download provides RPM packages for VMware Postgres PL/Java and VMware Postgres PL/R. Follow these steps to download and install these extensions.

  1. Download the VMware Postgres Extensions from VMware Tanzu Network and copy it to the Postgres server. The download file name has the format vmware-postgres-extensions-<postgres-version>.<platform>.zip.

  2. On the Postgres server, extract the contents of the VMware Postgres Extensions download file.

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

    This command extracts RPM files for the extensions.

PL/Java

  1. Install the PL/Java extension RPM.

    $ sudo yum install -y vmware-postgres-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-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.

Upgrading an Existing VMware Postgres Installation

To upgrade an existing VMware Postgres 11.2 or later installation, use the yum update command (instead of yum install) with the new RPM download. For example, to upgrade from an earlier VMware Postgres release to version 11.7, execute the following commands as root:

# cd ~/Downloads
# yum upgrade vmware-postgres-11.7.2.el7.x86_64.rpm

Note that the Postgres JDBC driver is not installed as an RPM. Simply extract and use the newer JAR file in your CLASSPATH.

Upgrading from VMware Postgres 11.1

Because of the RPM packaging changes introduced in VMware Postgres 11.2, performing an upgrade from version 11.1 to the latest release of the software may install additional components, in addition to upgrading installed components. For example, if you installed only the version 11.1 PostgreSQL Database RPM, upgrading using the new VMware Postgres Server RPM distribution would add pgBackRest, Patroni, and the ODBC driver in addition to updating the existing PostgreSQL Database component.

You cannot directly upgrade from VMware Postgres 11.1 to the current VMware Postgres Client package. If you want to install the VMware Postgres Clients on a machine that has the previous VMware Postgres packages installed, you must first remove those packages. For example:

# cd ~/Downloads
3 yum remove pivotal-postgres
3 yum install vmware-postgres-clients-11.7.2.el7.x86_64.rpm