Get On
ZoomAdmin Beta...
Note: Beta users will get a VERY special pricing, only limited seats are available, reserve your spot Now!
And Stay Updated On Our Progress ...
How To Install and Use PostgreSQL on Linux/Ubuntu

Introduction

 

The goal of this article is to go through all the steps necessary to install and configure PostgreSQL on Linux, including installing Admin Panel (pgAdmin) and enabling remote access to the database so that you can remotely login and manage your databases.

 

Sections:

 

  • Installing PostgreSQL
  • Configure PostgreSQL
  • Change PostgreSQL Default Port
  • Install pgAdmin PostgreSQL Admin Panel
  • Enable Remote Access / Firewall
  • Creating Test Database and Database Users

 

Installing PostgreSQL

 

Step 1

 

Run update command to update package repositories and get latest package information.

sudo apt-get update -y

Note: -y flag means to assume yes and silently install, without asking you questions in most cases.

Step 2

 

And now you can install the Postgres package with some additional utilities and functionality (postgresql-contrib)

sudo apt-get install postgresql postgresql-contrib

 

Configure PostgreSQL

 

After we installed PostgreSQL we need to configure it in order to be able to allow remote connections to the PostgreSQL database server.

Step 1

 

First, go to the /etc/postgresql/10/main/ 

cd /etc/postgresql/10/main

Note: here you go to the folder /10, which represents the current newest version available during your installation. Maybe, by the time you read this, the version will change so first check the version whether by typing

psql --version

or after executing 

cd /etc/postgresql/
 look what is it there in the folder postgresql with 
ls
command.  Then continue with

cd NAME_OF_FOLDER_YOU_FOUND/main

 

Step 2

 

Now staying in the same directory execute the following command.

sudo nano postgresql.conf

//here should be screenshot

After that go down till you find a line

#listen_addresses = ‘localhost’                        # what IP address(es) to listen on;

Uncomment it and change localhost to  ‘*’

The line after your change should look like this

listen_addresses = '*'

‘*’ means that the server will accept incoming connections on any IP assigned to an interface on the PostgreSQL server host.

Then save the file by pressing CTRL+X, type Y, and then hit the ENTER

 

Step 3

 

Again staying in the same directory execute the following command.

 

//here should be screenshot

 sudo nano pg_hba.conf

After that go down till you find a line

  host             all                all            127.0.0.1/32          md5

Change 127.0.0.1/32 to 0.0.0.0/0

The line after your change should look like this

host all all 0.0.0.0/0 md5

Then save the file by pressing CTRL+X, type Y, and then hit the ENTER

 

Change PostgreSQL Default Port

 

You would also want to change the default PostgreSQL server default port from 5432 to something else for security reasons.

Step 1

 

Execute the same commands as you did by ollowing the above instructions.

cd /etc/postgresql/10/main

sudo nano postgresql.conf

Step 2

 

After that go down till you find a line

port = 5432                                # (change requires restart)

Change  5432 to any port number you would like it to be changed

Then again save the file by pressing CTRL+X, type Y, and then hit the ENTER

Install pgAdmin PostgreSQL Admin Panel

 

Now let’s install and use pgAdmin  web based admin panel for PostgreSQL database server.

Step 1

Go to https://www.pgadmin.org/download/ page

Choose the OS.

//here shout be a screenshot

Click on the version.

Click on pgadmin_whatever_version_you_chose.exe

Wait untill the program gets installed.

Open it

 

Enable Remote Access / Firewall

Step by step instructions on enabling remote access and allowing you to login remotely on pgAdmin panel and managing your databases.  Note: opening firewall ports to public is not safe, so we will also show you how to find out your ip address and only allow your ip address for remote access.

Creating Test Database and Database Users

Step by step instructions and screenshots on creating a test database and database users using pgAdmin panel.

Install Let’s Encrypt Free SSL/TLS Certificate:
Configure DigitalOcean DNS:
Step 1

some description here aher eaontoer test test test
some description here aher eaontoer test test test

some command


Step 2

Verify DNS Updates have been saved properly. See an Example image below:


Replace Default Apache Website:
Get On
ZoomAdmin Beta...
Note: Beta users will get a VERY special pricing, only limited seats are available, reserve your spot Now!
And Stay Updated On Our Progress ...