Initializing help system before first use

Specifying an Alternative PostgreSQL Data Directory on RHEL

The default data directory for PostgreSQL 11.8 is /var/lib/pgsql/11/data. If you do not need to change the directory, skip this topic.
Important The steps below use the example alternative directory in the following steps is /external-vol/pgdata-11.8.
  1. Complete one of the following based on the version of Red Hat Enterprise Linux(RHEL).
    • RHEL 6:
      1. Create and edit /etc/sysconfig/pgsql/postgresql-11.
      2. Add the following line then save and close the file:
        PGDATA=/external-vol/pgdata-11.8
    • RHEL 7:
      1. Create and edit /etc/systemd/system/postgresql-11.service.
      2. Add the following content:
        .include /lib/systemd/system/postgresql-11.service
        [Service]
        Environment=PGDATA=/external-vol/pgdata-11.8
      3. Reload the Systemd configuration:
        systemctl daemon-reload
  2. Set the PGDATA environment variable to point to the custom data directory. This is necessary for the Xpress Insight Server installer to find the custom data directory: export PGDATA="/external-vol/pgdata-11.8"