How To Install PostgreSQL On Ubuntu

How To Install PostgreSQL On Ubuntu
Techiio-author
Written by Shuvhojit DebDecember 20, 2021
4 min read
PostgreSQL
1 VIEWS 1 LIKES 0 DISLIKES SHARE
1 LIKES 0 DISLIKES 1 VIEWS SHARE
Techiio-author
Shuvhojit Deb

Full Stack Developer

Today we'll install PostgreSQL on Ubuntu.

PostgreSQL

It is made alive by PostgreSQL Global Development Group, a different group of many companies and individual contributors who made this possible. It is mainly run on Linux/Unix platform.

You will find PostgreSQL, also known as Postgres. This is an object-relational database management system, And it uses SQL (Structured query language) as its main query language. DBMS is a combination of applications, different utilities, and libraries. Over the years, there are no. database management systems out there. The object-relational database specifies large, shared databases.

Prerequisites

An Ubuntu 18.04 Linux system

Access to a command-line/terminal window (Ctrl+Alt+T)

A user account with sudo privileges

Install PostgreSQL on Ubuntu

Step 1: Add PostgreSQL Repository

To install from the official repository, you first need to add it to your system.

Import the GPG repository key with the commands:

sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

blogpost

Then, add the PostgreSQL repository by typing:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ 'lsb_release -cs'-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

Step 2: Update the Package List

After adding the official PostgreSQL repository, make sure to update the package list. Doing this ensures you install the latest PostgreSQL package.

sudo apt-get update

Step 3: Install PostgreSQL

To install PostgreSQL and the PostgreSQL contribs package (which provides additional features), use the following command:

sudo apt-get install postgresql postgresql-contrib
blogpost

By default, the software creates a postgres user, once you successfully install the database system. This user account has the default ‘postgres’ role.

Connect to PostgreSQL

To establish a connection with the newly set-up database, log into the postgres account with:

sudo su - postgres

Now open a postgress prompt using the command:

psql
blogpost

Accessing Postgres through terminal.

Check Connection Information

If you are connected to PostgreSQL and want to see details of the connection, use the command:

\conninfo

The output displays information on the database name, the account you are logged in, the socket path, and port number.

blogpost

PostgreSQL
Install PostgreSQL
1 VIEWS 1 LIKES 0 DISLIKES SHARE
1 LIKES 0 DISLIKES 1 VIEWS SHARE
Was this blog helpful?
techiio-price-plantechiio-price-plantechiio-price-plantechiio-price-plantechiio-price-plan
You must be Logged in to comment
Code Block
Techiio-author
Shuvhojit Deb
Full Stack Developer
Techiio-followerTechiio-follower
117 Blog Posts
0 Discussion Threads
Trending Technologies
15
Software40
DevOps46
Frontend Development24
Backend Development20
Server Administration17
Linux Administration26
Data Center24
Sentry24
Terraform23
Ansible83
Docker70
Penetration Testing16
Kubernetes21
NGINX20
JenkinsX17
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance