Created
November 25, 2017 16:52
-
-
Save j1n3l0/c69280f039884e41e6cd3cb80163be07 to your computer and use it in GitHub Desktop.
Install potgres 9.4 on Ubuntu 17.10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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