How to Install Postgresql on Ubuntu

PostgreSQL is a relational database which is a standardized compliant open-source database platform. It has features of a traditional commercial database with enhancements which can be found in next-generation DBMS systems. It is a very fast and reliable relational database system.


In this tutorial, we will show you how to install postgreSQL on Ubuntu.

Step 1 – Install PostgreSQL development packages

First of all, let’s open up the terminal application.

There may be cases where you will need the PostgreSQL development package to build its own native extension. To install the PostgreSQL development packages, type in:

“sudo apt-get install libpq-dev” and hit enter.

Installing PostgreSQL development packages

Step 2 – Enter the password

With that done, you will be required to type in the password and after that, the processing will start automatically and you can continue with the installing of postgresql on ubuntu.

Insert the password

Step 3 –Add PPA repository

Once done, we will add the PPA repository to Ubuntu. For that, type in:

“sudo add-apt-repository ppa:pitti/postgresql”

Adding PPA repository to Ubunto

Step 4 – Hit the enter key when prompted

Once the notification is displayed, simply hit the “enter” key to continue with the installing of postgresql on ubuntu.

Press enter when prompted

Step 5 – Updates for PostgreSQL

Now we will simply install PostgreSQL in Ubuntu. To do that, we will first get an update and for that, type in: “sudo apt-get update”

Find updates for PostgreSQL

Step 6 – Install PostgreSQL command

After that, type in:

“sudo apt-get install postgresql-9.2”

Installing PostgreSQL

Step 7 – Proceed with the installation

This will start the installation process. You will be displayed with all the details regarding the installation, which packages would be installed and how much disk space will be consumed. When prompted “do you want to continue”, hit yes and the installation will start automatically. Hope you’d find our “how to install postgresql on ubuntu” step by step guide useful.

Continue with the installation