Yulia Portnova | 058a288 | 2015-02-20 17:59:12 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # install postgres |
| 4 | apt-get update |
| 5 | apt-get install postgresql postgresql-contrib |
| 6 | |
| 7 | # check if postrges cluster created |
| 8 | |
| 9 | if [ ! -d /etc/postgresql ]; then |
| 10 | err=$(pg_createcluster 9.3 main --start 2>&1 /dev/null ) |
| 11 | if [ $? -ne 0 ]; then |
| 12 | echo "There was an error while creating cluster" |
| 13 | exit 1 |
| 14 | fi |
| 15 | fi |
| 16 | |
| 17 | sed -i 's/^local\s\+all\s\+all\s\+peer/local all all trust/g' /etc/postgresql/9.3/main/pg_hba.conf |
| 18 | echo "listen_address = '*'" >> /etc/postgresql/9.3/main/postgresql.conf |
| 19 | |
| 20 | |