Skip to content

Instantly share code, notes, and snippets.

Last active February 24, 2020 17:45
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
postgres 11 hints

Pre-installation cleanup

dpkg -l | grep postgres
sudo apt-get purge postgresql*  # or
sudo apt-get --purge remove postgresql\*

sudo rm -rf /var/lib/postgresql/
sudo rm -rf /var/log/postgresql/
sudo rm -rf /etc/postgresql/
sudo deluser postgres


sudo apt install postgresql


sudo systemctl status postgresql
sudo systemctl restart postgresql

sudo service postgresql restart
sudo service postgresql status

Config & log

sudo nano /etc/postgresql/11/main/pg_hba.conf
sudo nano /etc/postgresql/11/main/postgresql.conf

tail -f /var/log/postgresql/postgresql-11-main.log

Create user & DB

sudo su postgres

createuser -P <USER>

createdb -O <USER> <DB>
dropdb <DB>

Change user password

sudo -u postgres psql

\password <USER>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment