Here I will explain how to configure PostgreSQL on Ubuntu Server and connect with your local machine.
First of all, you need a ubuntu server and connect your server using SSH. When you are connected with SSH use the following commands to install PostgreSQL on Ubuntu.
PostgreSQL is installed on your Ubuntu server. Currently, your database user is Postgres that has all database related privilege. Now you need to create a new user with a password so that you can connect the database using your app or any database connection tool like DataGrip.
I have created a user named sheetal.
Now I will create a new user and database named sheetal. So first you need to switch your user to postgres.
Now your current active user is postgres.
This will ask for a password to be set for the user. Please remember this password, this will require to connect your database.
You have a user, password and a database. Now if you server port 5432 is now publicly open then open it your server firewall and security setting. So that you can connect the database publicly.
Now you need to update postgres configuration to allow users to connect the database from anywhere.
Now restart your Postgres service.
All is done on the server side. Now open DataGrip on your local system and connect.
Now you are live with your database. Enjoy the successful connection.