Skip to content

Instantly share code, notes, and snippets.

@j1n3l0
Created November 25, 2017 16:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j1n3l0/c69280f039884e41e6cd3cb80163be07 to your computer and use it in GitHub Desktop.
Save j1n3l0/c69280f039884e41e6cd3cb80163be07 to your computer and use it in GitHub Desktop.
Install potgres 9.4 on Ubuntu 17.10
#!/bin/sh -ex
# install postgres 9.4
# add-apt-repository "deb https://apt.postgresql.org/pub/repos/apt `lsb_release -sc`-pgdg main"
add-apt-repository "deb https://apt.postgresql.org/pub/repos/apt zesty-pgdg main"
wget --quiet -O - https://postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
apt-get update
apt-get install -y postgresql-9.4
# listen from all addresses
perl -i -ple "s/#listen_addresses\s=\s'localhost'/listen_addresses = '*' /g" /etc/postgresql/9.4/main/postgresql.conf
# no password for postgres user
perl -i -ple 's/^(local.+postgres\s+)\w+$/${1}trust/' /etc/postgresql/9.4/main/pg_hba.conf
# no password from other vagrant vm hosts
cat <<EOF >> /etc/postgresql/9.4/main/pg_hba.conf
host all all 127.0.0.1/8 trust
EOF
# restart postgres
systemctl restart postgresql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment