Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Instructions on opening port 5432 on ubuntu #9

Open
cmatKhan opened this issue May 21, 2021 · 3 comments
Open

Add Instructions on opening port 5432 on ubuntu #9

cmatKhan opened this issue May 21, 2021 · 3 comments

Comments

@cmatKhan
Copy link
Member

get into sudo vim /etc/postgresql/12/main/postgresql.conf

Uncomment, and change the value to '*', this will allow Postgres connections from anyone.

listen_addresses = '*'

Save and exit the file. Next, modify pg_hba.conf to also allow connections from everyone. Open the file with your preferred editor:

sudo vim /etc/postgresql/12/main/pg_hba.conf  

Modify this section:

# IPv4 local connections:
host    all             all             127.0.0.1/32            md5

To this:

# IPv4 local connections:
host    all             all             0.0.0.0/0            md5

https://www.digitalocean.com/community/questions/remote-access-to-postgresql-with-pgadmin

open the firewall

sudo ufw allow 5432/tcp

https://stackoverflow.com/a/51597485/9708266

@cmatKhan
Copy link
Member Author

read up on security re: opening connections to anyone -- is there a best practice other than 0.0.0.0/0?

@cmatKhan
Copy link
Member Author

don't modify -- just add the IPv4 line

also add the IPv6 protocol

@cmatKhan
Copy link
Member Author

add this in instructions:

╭─ ~ ─────────────────────────────── database_admin@ip-172-31-37-99 13:02:36 ─╮
╰─❯ sudo service postgresql restart ─╯

╭─ ~ ─────────────────────────────── database_admin@ip-172-31-37-99 13:03:31 ─╮
╰─❯ sudo systemctl restart nginx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant