❖ How to Install PostgreSQL @ Home |
These slides (and accompanying video) describe
makegcc❖ How to Install PostgreSQL @ Home (cont) |
Summary:
./configure --prefix=makemake installPGHOSTPGDATAPATHinitdb/data/postgresql.confpg_ctl start -l /Log❖ How to Install PostgreSQL @ Home (cont) |
My env
# Set up environment for running PostgreSQL
# Must be "source"d from sh, bash, ksh, ...
# PostgreSQL needs more memory on MacOS
# sudo sysctl -w kern.sysv.shmmax=1073741824
# sudo sysctl -w kern.sysv.shmall=1073741824
PGHOME=/Users/jas/pgsql
export PGDATA=$PGHOME/data
export PGHOST=$PGDATA
export PGPORT=5432
export LD_LIBRARY_PATH=$PGHOME/lib
PATH=$PGHOME/bin:$PATH
pg1() { pg_ctl start -l $PGHOME/log ; }
pg0() { pg_ctl stop ; }
Obviously, adjust to suit your local conditions
❖ How to Install PostgreSQL @ Home (cont) |
On MacOS, PostgreSQL grabs more memory than MacOS expects
If you have "Out of memory" (or somesuch) errors, you'll need
# PostgreSQL needs more memory sudo sysctl -w kern.sysv.shmmax=1073741824 sudo sysctl -w kern.sysv.shmall=1073741824
You only need to run these commands once (if at all)
❖ How to Install PostgreSQL @ Home (cont) |
What I edited in postgresql.conf
...
listen_addresses = '' # what IP address(es) to listen on;
#port = 5432 # (change requires restart)
max_connections = 8 # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
unix_socket_directories = '/Users/jas/pgsql13/data'
# comma-separated list of directories
# (change requires restart)
...
The socket directory has to match the value of $PGDATA
Produced: 18 Sep 2022