Skip to content

Instantly share code, notes, and snippets.

@defaye
Last active June 2, 2020 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save defaye/59281bfdb9aaa367b7119ce962d5b5dc to your computer and use it in GitHub Desktop.
Save defaye/59281bfdb9aaa367b7119ce962d5b5dc to your computer and use it in GitHub Desktop.
Install PostgreSQL 10 for local development on Ubuntu 18.04
sudo apt update && sudo apt install -y postgresql-10 libpq-dev postgresql-contrib
sudo cp /etc/postgresql/10/main/pg_hba.conf /etc/postgresql/10/main/pg_hba.conf.backup
sudo sed -i -E "s/^(local\s+all\s+postgres\s+)peer$/\1trust/" /etc/postgresql/10/main/pg_hba.conf
sudo sed -i -E "s/^(local\s+all\s+all\s+)md5$/\1trust/" /etc/postgresql/10/main/pg_hba.conf
sudo sed -i -E "s/^(host\s+all\s+all\s+127\.0\.0\.1\/32\s+)md5$/\1trust/" /etc/postgresql/10/main/pg_hba.conf
sudo sed -i -E "s/^(host\s+all\s+all\s+::1\/128\s+)md5$/\1trust/" /etc/postgresql/10/main/pg_hba.conf
sudo service postgresql restart
@defaye
Copy link
Author

defaye commented Jun 2, 2020

To run this command in one line:

curl -s https://gist.github.com/defaye/59281bfdb9aaa367b7119ce962d5b5dc/raw/6b18e3a9293c833bae20fb48854d42b1271fa434/install_postgresql.sh | sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment