Last active
March 25, 2024 07:53
-
-
Save wagura-maurice/c8a34b28dadfe65bf6d106ce578578d8 to your computer and use it in GitHub Desktop.
PostgreSQL.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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