Setting up pg locally for Heroku deployment

My main home server had issues previously getting postgres installed.

However for an application switch to Heroku I've wanted to get it working.
Though not 100% necessary, as I could have (say) mysql locally and pg remotely, I much prefer having the same database and eliminating complexity 🙂
Adding pgadmin3 for admin.

postgres is a little more work to set up than mysql, e.g.

castle2011 unix box – postgres:
user/pass – postgres/******

Start with: sudo apt-get install postgresql

sudo vi /etc/postgresql/8.4/main/postgresql.conf
remove the # comment sign before "listen_addresses"

then sudo -u postgres psql template1
-enter password
then, in sql prompt, e.g. template1=# use `ALTER USER postgres with encrypted pword '*****';`

then sudo vi /etc/postgresql/8.4/main/pg_hba.conf

q to exit (exit and quit do not work).

Add:

,,,
# or via the -i or -h command line switches.
#

local all postgres md5

# DO NOT DISABLE!
,,,

Finally:
sudo /etc/init.d/postgresql restart
restarts the server

Going forward:
su postgres
-pword-
psql
-pword-
then

`psql` and password

postgres=#

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s