Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 1 | #!/bin/bash |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 2 | set -e |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 3 | |
| 4 | if [ ! -d /etc/postgresql ]; then |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 5 | apt-get update |
| 6 | apt-get install -y postgresql postgresql-contrib |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 7 | 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 |
| 12 | fi |
| 13 | |
| 14 | sed -i 's/^local\s\+all\s\+all\s\+peer/local all all trust/g' /etc/postgresql/9.3/main/pg_hba.conf |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 15 | sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/9.3/main/postgresql.conf |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 16 | |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 17 | service postgresql restart |
Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 18 | |
Yulia Portnova | 7ddfa73 | 2015-02-24 17:32:58 +0200 | [diff] [blame] | 19 | exit 0 |