Friday, October 12, 2018

configuring posgresql server on raspberry pi

I always burn time re-figuring out how to do this.

  1. postgres config files are in /etc/postgresql/9.6/main
  2. edit postgresql.conf to listen on port 5432 (listen_addresses = '*')
  3. verify with netstat -nlt that you're listening on port 5432 to addresses other than localhost.
  4. edit pg_hba.conf to allow the user to connect (host all all 192.168.1.0/24 md5)
  5. in the past I've had issues because I've created the database without a password, so I've needed to do an "alter user pi password '<password>'"
  6. verify by dbGetQuery(con,"select current_time") in R (RPostgreSQL), or dbGetQuery(con,"select current_time") from Python (psycopg2)
  7. this post probably says it all better.

No comments: