Sha256: 49a0908947910f6b69a87f9218e95f8cb9aefbe25f8d845701baeab9d222cc64

Contents?: true

Size: 995 Bytes

Versions: 12

Compression:

Stored size: 995 Bytes

Contents

#!/bin/bash

apt-get install -qy postgresql postgresql-contrib libpq-dev postgresql-client

POSTGRES_VERSION=$(dpkg-query -W -f='${Depends}' postgresql |
    sed 's/\postgresql-//g')

# allow connections on the local network
cat << EOF >> /etc/postgresql/$POSTGRES_VERSION/main/pg_hba.conf
# Allow connections on the 192.168.*.* local/VM network
host    all             all             192.168.0.0/16          md5
host    all             all             172.16.0.0/12           md5
EOF

# enable listening on all addresses
sed -i.bak "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/$POSTGRES_VERSION/main/postgresql.conf

# restart postgres
service postgresql restart

# create a local user
# createuser --createdb --super --pwprompt -e vagrant (with a password of 'vagrant')
su postgres -c "psql -c \"CREATE ROLE vagrant PASSWORD 'md5ce5f2d27bc6276a03b0328878c1dc0e2' SUPERUSER CREATEDB NOCREATEROLE INHERIT LOGIN;\""

# create a history file
touch ~/.psql_history

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
boxes-3.7.0 scripts/postgres.sh
boxes-3.6.1 scripts/postgres.sh
boxes-3.6.0 scripts/postgres.sh
boxes-3.5.0 scripts/postgres.sh
boxes-3.4.0 scripts/postgres.sh
boxes-3.3.1 scripts/postgres.sh
boxes-3.3.0 scripts/postgres.sh
boxes-3.2.0 scripts/postgres.sh
boxes-3.1.0 scripts/postgres.sh
boxes-3.0.0 scripts/postgres.sh
boxes-2.5.0 scripts/postgres.sh
boxes-2.4.0 scripts/postgres.sh