Setup

Local Setup

brew install postgresql

Follow instructions onscreen(brew services start postgresql & initdb /usr/local/var/postgres )

postgres -V

psql to enter cml

On Server

GCP guide

  1. Create Ubuntu server on whatever Cloud Provider with some hard disk space or something idk

  2. Install postgres

sudo apt update
sudo apt -y install postgresql postgresql-client postgresql-contrib
  1. Setup user

Default user is postgres, but you need to set the password as it doesn't have one

sudo -u postgres psql postgres
\password postgres
#add password
CREATE EXTENSION adminpack; #enables server instrumentation
\q
  1. Edit pg_hba.conf

sudo nano /etc/postgresql/12/main/pg_hba.conf

ip4.me => Get your ipv4 address

# IPv4 remote connections for the tutorial:
host    all             all           [YOUR_IPV4_ADDRESS]/32         md5
  1. Edit postgresql.conf to listen on all IP addresses

sudo nano /etc/postgresql/12/main/postgresql.conf

Find the line:

#listen_addresses = 'localhost'

And turn into:

listen_addresses = '*'

Save, exit, and restart in bash

sudo service postgresql restart
  1. For your cloud provider make sure the server can be accessed by all IPs

Last updated