Configure PostgreSQL environment variables for enterprise Linux administration, automation and PostgreSQL operational management.
PostgreSQL environment variables simplify database administration by allowing Linux shells and scripts to automatically access PostgreSQL binaries, data directories and tools.
This guide demonstrates how to configure PostgreSQL environment variables permanently on Linux systems.
Open the bash profile file for the PostgreSQL user.
vi ~/.bash_profile
Add PostgreSQL binary and data paths.
export PATH=/usr/pgsql-17/bin:$PATH export PGDATA=/var/lib/pgsql/17/data
Save and exit the editor.
:wq
Reload the profile configuration.
source ~/.bash_profile
which psql
psql --version
echo $PGDATA
PostgreSQL administration, replication architecture, high availability, performance tuning and enterprise DBA consulting.