PGAdmin and Linux Postgres Connectivity via SSH Tunnel Configuration


Find all the steps to setup PostgresDB on Linux machine on this page.

 Prerequisite
  • PostgresDB installed on Linux Machine
 Steps for setup

Step 1:

Step 2:

  • In you have installed postgres, open pg_hba.conf, and check  IP-127.0.0.1 is used in that file. If so, we can use localhost for SSH tunneling to connect PGAdmin.

                                                                       (Or)

  • If you have changed to 0.0.0.0 in  pg_hba.conf, we can use either localhost or Linux IP  for SSH tunneling to connect PGAdmin

Note:

For Insights development, IP is configured as 127.0.0.1. So we can use localhost.

                                                    (Or)

If you have already installed postgres refer below link to configure-postgresql-to-allow-remote-Connection -

           https://blog.bigbinary.com/2016/01/23/configure-postgresql-to-allow-remoteconnection.html

Step 3:

  • Open putty and input IP, Select SSH->Auth->Tunnels. Enter Source port as 5432,  and Destination as localhost:5432. (See screenshot below)                                                                                                                                                                      

                 

Step 4:

  • Browse and select the PPK file for opening that box. (See screenshot below)

Step 6:

  • Click Open and check the login screen opens. (See screenshot below)

Step 7:

  • Check 5432 port is listening using the netstat command in linux box. (See screenshot below)

Step 8:

  • Click and open installed PgAdminPortable on your windows box. (See screenshot below)

Step 9:

  • Choose File -> Add Server. (See screenshot below)

Step 10:

  • Give the details Name, Host, Port and Password in server registration window. (See screenshot below)


Note:

Create password for postgres using passwd command(Ex- passwd postgres) and click OK.


Step 11:

  • Click OK for password. (See screenshot below) 

Step 12:

  • Postgres Databases are configured successfully. (See screenshot below) 

©2021 Cognizant, all rights reserved. US Patent 10,410,152