Skip to content

Instantly share code, notes, and snippets.

@bradkarels
Created January 1, 2020 01:44
Show Gist options
  • Save bradkarels/6cc777dbc84d2c02d7d989fce2cba60e to your computer and use it in GitHub Desktop.
Save bradkarels/6cc777dbc84d2c02d7d989fce2cba60e to your computer and use it in GitHub Desktop.
Making my Pi Postgresql DB available on my network

From: https://opensource.com/article/17/10/set-postgres-database-your-raspberry-pi

'''

  1. Edit the PostgreSQL config file /etc/postgresql/9.6/main/postgresql.conf to uncomment the listen_addresses line and change its value from localhost to *. Save and exit.

  2. Edit the pg_hba config file /etc/postgresql/9.6/main/pg_hba.conf to change 127.0.0.1/32 to 0.0.0.0/0 for IPv4 and ::1/128 to ::/0 for IPv6. Save and exit.

  3. Restart the PostgreSQL service: sudo service postgresql restart.


/etc/postgres/11/main

- Connection Settings -

listen_addresses = '' #listen_addresses = 'localhost' # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to 'localhost'; use '' for all # (change requires restart) port = 5432 # (change requires restart)


/etc/postgres/11/main

IPv4 local connections:

host all all 127.0.0.1/32 md5 host all all 192.168.0.1/24 md5 #All 192.169.x.x addresses.


Then restart postgres:
sudo service postgresql restart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment