Skip to content

Instantly share code, notes, and snippets.

@Ruzzz
Last active February 24, 2020 17:45
Show Gist options
  • Save Ruzzz/057ad6de7a836560eee3df8ad5fdaa67 to your computer and use it in GitHub Desktop.
Save Ruzzz/057ad6de7a836560eee3df8ad5fdaa67 to your computer and use it in GitHub Desktop.
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

Install

sudo apt install postgresql

Service

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>
...
\q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment