Specifying an Alternative PostgreSQL Data Directory on RHEL
The default data directory for PostgreSQL
11.
10 is
/var/lib/pgsql/11/data. If you do not need to change the directory, skip this topic.
![]() |
Note These are RHEL 7 commands. RHEL 6 users must translate the service commands into the old form.
|
![]() |
Important The steps below use the example alternative directory in the following steps is
/external-vol/pgdata-11.10.
|
- Perform the following steps:
- RHEL 7:
- Create and edit /etc/systemd/system/postgresql-11.service.
- Add the following content:
.include /lib/systemd/system/postgresql-11.service [Service] Environment=PGDATA=/external-vol/pgdata-11.10
- Reload the Systemd configuration:
systemctl daemon-reload
- RHEL 7:
- 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.10"