How to install PostgreSQL and pgAdmin4

Install PostgreSQL and pgAdmin4 in Ubuntu

PostgreSQL is a powerful, reliable, robust and Open Source relational database system.

This tutorial will explain how to install the latest version of PostgreSQL and pgAdmin4 on Ubuntu 20.04 LTS system.

Prerequisites

A running Ubuntu 20.04 LTS system

Login as sudo user via SSH and run the commands.

$ sudo apt update
$ sudo apt install wget curl ca-certificates

Install PostgreSQLInstall PostgreSQL and pgAdmin4 in Ubuntu

Import the repository GPG key to your system

$ wget -o - https://www.postgresql.org/media/keys/ACCCC4CF8.asc | sudo apt-key add -

Create a PPA file for Postgresql

$ sudo sh -c ‘echo “deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main” >> /etc/apt/source.list.d/pgdg.list’

After adding PPA, Execute the following commands

$ sudo apt update
$ sudo apt install –y postgresql postgresql-contrib

After installation verify postgresql service

$ sudo systemctl status postgresql
$ sudo systemctl enable postgresql
$ sudo systemctl restart postgresql
$ sudo systemctl status postgresql

Connection to PostgreSQLInstall PostgreSQL and pgAdmin4 in Ubuntu

Establish connection with newly installed database

$ sudo su - postgres

Then type “psql” to get postgres prompt.

You can see connection information details using below command

postgres=# conninfo
conninfo

pgAdmin Installation

Import the repository GPG key to your system

$ curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add -

Create a PPA file for Postgresql

$ sudo sh -c ‘echo “deb https://ftp.postgresql.org/pub/pgadmin4/apt/focal pgadmin4 main” >> /etc/apt/source.list.d/pgadmin4.list’

After adding PPA, Execute the following commands

$ sudo apt update
$ sudo apt install –y pgadmin4

Run the below command in order to login screen to the pgAdmin4 web dashboard.

$ sudo /usr/pgadmin4/bin/setup-web.sh

If the page is not loading then restart the apache2 server

$ sudo systemctl restart apache2
login pgadmin3 web

Please follow our posts on our website

Open Source Listing

You can also follow us on Facebook and Twitter.

Previous Post
Next Post

Comments

Top 10 Open Source Database Softwares - Open Source Listing

[…] PostgreSQL uses a query language similar to SQL, called PostgreSQL SQL (or simply, “PostgreSQL”). It offers many advanced features such as transaction support, nested transactions, and advanced locking mechanisms. It also supports a wide range of data types, including user-defined types, arrays, and composite types. […]

How to Setup PostgreSQL Replication - Open Source Listing

[…] advantage of PostgreSQL is its extensibility. It supports a range of extensions that can be used to enhance its […]

Leave a Reply

Your email address will not be published. Required fields are marked *