Skip to content

Instantly share code, notes, and snippets.

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 wagura-maurice/c8a34b28dadfe65bf6d106ce578578d8 to your computer and use it in GitHub Desktop.
Save wagura-maurice/c8a34b28dadfe65bf6d106ce578578d8 to your computer and use it in GitHub Desktop.
PostgreSQL.txt
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install postgresql postgresql-contrib
sudo adduser postgres
sudo passwd postgres
usermod -a -G sudo postgres
su - postgres
psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'Rtcv39$$';"
createuser montanabay --pwprompt
ALTER USER montanabay WITH SUPERUSER;
sudo nano /etc/postgresql/9.5/main/postgresql.conf
listen_addresses = '*'
sudo nano /etc/postgresql/9.5/main/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
host all all 0.0.0.0/0 md5
# IPv6 local connections:
host all all ::0/0 md5
# All IPs
host all all all md5
sudo systemctl restart postgresql
sudo ufw allow 5432/tcp
https://www.linode.com/docs/databases/postgresql/how-to-install-postgresql-on-ubuntu-16-04/
http://devopspy.com/linux/allow-remote-connections-postgresql/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment