Skip to content

Instantly share code, notes, and snippets.

@lindblom
Last active October 27, 2022 01:22
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lindblom/41b3aaaf03f3ef3ebcf8d71dc8615433 to your computer and use it in GitHub Desktop.
Save lindblom/41b3aaaf03f3ef3ebcf8d71dc8615433 to your computer and use it in GitHub Desktop.
# ensure deps
sudo apt update
sudo apt install wget curl ca-certificates gnupg
# add repo to apt
wget -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
# install postgres
sudo apt update
sudo apt install postgresql postgresql-contrib
# restart postgres
sudo systemctl status postgresql
# switch to postgres user
sudo su - postgres
# create application user
createuser --interactive --pwprompt
# edit postgres.conf
vim /etc/postgresql/13/main/postgresql.conf
# edit pg_hba.conf
vim /etc/postgresql/13/main/pg_hba.conf
# exit out of postgres user
exit
# restart postgres
sudo systemctl status postgresql
# install postgis if you want it
sudo apt install postgis postgresql-13-postgis-3 postgresql-13-postgis-3-scripts
# restart postgres again
sudo systemctl status postgresql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment