blob: e7ca3bcc09cb53edeb431c3856ed3073d1b58a17 [file] [log] [blame]
Yulia Portnova058a2882015-02-20 17:59:12 +02001#!/bin/bash
Yulia Portnova7ddfa732015-02-24 17:32:58 +02002set -e
Yulia Portnova058a2882015-02-20 17:59:12 +02003
4if [ ! -d /etc/postgresql ]; then
Yulia Portnova7ddfa732015-02-24 17:32:58 +02005 apt-get update
6 apt-get install -y postgresql postgresql-contrib
Yulia Portnova058a2882015-02-20 17:59:12 +02007 err=$(pg_createcluster 9.3 main --start 2>&1 /dev/null )
8 if [ $? -ne 0 ]; then
9 echo "There was an error while creating cluster"
10 exit 1
11 fi
12fi
13
14sed -i 's/^local\s\+all\s\+all\s\+peer/local all all trust/g' /etc/postgresql/9.3/main/pg_hba.conf
Yulia Portnova7ddfa732015-02-24 17:32:58 +020015sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/9.3/main/postgresql.conf
Yulia Portnova058a2882015-02-20 17:59:12 +020016
Yulia Portnova7ddfa732015-02-24 17:32:58 +020017service postgresql restart
Yulia Portnova058a2882015-02-20 17:59:12 +020018
Yulia Portnova7ddfa732015-02-24 17:32:58 +020019exit 0