PostgreSQL is used by many large companies to save and store their data for various applications and it supports various programming interfaces as well as videos, texts, and images. In this article we’ll first go through the installation of PostgreSQL on ubuntu 20.04 then we’ll configure it to allow remote connection

Prerequsities

This article assumes that you already have running a PostgreSQL server on your system. If not, use one of the below links to install the PostgreSQL database server on your system.

Find Configuration File

In order to install PostgreSQL on our system we need to update our repository and for that execute the below command: You need to change the listening address in the postgresql.conf configuration file showing in the command output. Also, you need to edit “pg_hba.conf” in the same directory to allow remote access.

Configure PostgreSQL to Allow Remote Connections

In order to allow all the IP addresses to connect to the PostgreSQL server, we need to configure the file and make some changes, for that you have located the configuration file in the previous step. That’s it. Your PostgreSQL database server is accessible from remote hosts. This command will open this file and in it, you need to search “listen_addresses” and add the following line. All you’ve to do is change the listening address from localhost to “*” or add a new line as shown above. This will allow every IP address to be connected to the database server, or if you want to specify some particular ips you can type them with spaces between each IP address. Now open the file using the command provided below: In the file you’ve to add the following lines in file: Save the configuration file and close it. Now simply open the port “5432” in the firewall and you’re all set to see all the databases and you can bond from whichever ip address to the server of PostgreSQL:

Conclusion

PostgreSQL database is default set to bond with localhost which restricts the other IP address and host to connect or have the access to the PostgreSQL server. In this article, we guided you through the configuration of PostgreSQL to allow remote connection so that other IPs can bond to the server. In this way, other hosts can easily see the list of databases and connect to the PostgreSQL server remotely.

How To Configure PostgreSQL to Allow Remote Connections   TecAdmin - 7How To Configure PostgreSQL to Allow Remote Connections   TecAdmin - 76