Home Linux How to Install PostgreSQL 11 on Ubuntu 16.04 & 18.04

How to Install PostgreSQL 11 on Ubuntu 16.04 & 18.04

I want to install PostgreSQL 11 on Ubuntu. How can I ??

PostgreSQL is an open source RDMS (Relational Database Management System). It allows custom functioning using various programming languages like C/C++, Java etc.
In this tutorial, you will know how to install PostgreSQL version 11 on Ubuntu system. Moreover, will let you know how to connect the database through the terminal.

Step1: Add PostgreSQL Repository

Firstly, run the following command to add the PostgreSQL repository in the Ubuntu system. As shown in the below screenshot and in this command, there is key to authenticate and validate packages.

$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" > /etc/apt/sources.list.d/PostgreSQL.list'
Add PostgreSQL Repository on Ubuntu

Step 2: Install PostgreSQL

Above all, we have added the repository to the Ubuntu system. Now run the following command to install.

$ sudo apt-get update
$ sudo apt-get install postgresql-11 

Finally, this command will install the PostgreSQL 11 version. Clearly, shown in the below screenshots.

Install postgresql 11 command on Ubuntu
Install postgresql 11 command on Ubuntu

Read More: How to Install MySQL on Ubuntu 18.04 Release.

After installing the database, you can connect to it. By default, it creates user “postgres” to connect with the database “postgres”.

Connect to postgresql from terminal
Connect to postgresql from terminal

Additionally, to disconnect from database, just type the \q on the terminal.

postgres-# \q



You can also connect graphically with PostgreSQL by installing pgAdmin. In the next article, will help you with the installation of pgAdmin.


Conclusion: You have learned how to install PostgreSQL 11 version on the Ubuntu 16.04 & 18.04 system. For any feedback, please write in the below comment box.

LEAVE A REPLY

Please enter your comment!
Please enter your name here