How to install PostgreSQL on Ubuntu 17.04

PostgreSQL is a stable, powerful relational database server. PostgreSQL is available for Linux, Windows and other system. On this tutorial, we will show you how to install PostgreSQL on Ubuntu 17.04. PostgreSQL is a great database management system that mostly used by enterprise class business. It’s a well known database system as it’s robust, stable on handling high workload level. PostgreSQL is a suitable database system for Enterprise with more than 30 years of development. 

Install PostgreSQL on Ubuntu 17.04

What you will learn on this tutorial:

  • Install PostgreSQL 
  • Create new user
  • Setup new database Postgresql

Step 1. Install PostgreSQL 

Open Terminal or connect to Ubuntu 17.04 via SSH. First, update Ubuntu to ensure you have up to date system. 

Now execute this command to install PostgreSQL


Additionally, we can also install postgresql-client package.

Step 2. Manage PostgreSQL 

By default, there is only one user (postgres) that can access the PostgreSQL database. On this practice we will show you to create new user for the PostgreSQL Database. For example, we will create new user called “dhani“. 

A. Add new Linux user called dhani

B. Add new PostgreSQL user

First, login using postgres user on Ubuntu

Next Execute this command on Terminal


Add user called dhani


At this point, new user dhani has been created. Now we can log in to PostgreSQL using user dhani. 

C. Setup new database on PostgreSQL

Since we don’t have default database for user dhani, you will get the following error when trying to use psql command under user dhani.

So, we will create a new database. We must use user postgres to create new database.

Output sample:

Now grant dhani to new database

Thanks for reading this how to install PostgreSQL on Ubuntu 17.04. Please share this article if you think this useful. Cheers


Leave a Reply

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