Install PostgreSQL 9.5 on Ubuntu 15.10, 14.04 & 12.04

PostgreSQL is a relational database management system. PostgreSQL permits us to execute stored procedures in different programming languages, similar to C/C++, Python, Java, Perl, Ruby and its own PL/pgSQL, which is like Oracle’s PL/SQL. Postgres supports several operating systems like Linux, UNIX (AIX, BSD, HP-UX, SGI IRIX, Mac OS X, Solaris, Tru64), and Windows.
Install PostgreSQL
See Also:

  • Install PostgreSQL 9.5 on CentOS/RHEL 7/6/5
  • Step 1: Add PostgreSQL Apt Repository

    PostgreSQL is available in default Ubuntu repository but we will install PostgreSQL its install PostgreSQL 9.1. So first add PostgreSQL apt repository in your system to install PostgreSQL 9.5.

    # sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    # wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
    

    Step 2: Install PostgreSQL

    After adding PostgreSQL official repository in our system, First we need to update repository list. After that install PostgreSQL Server 9.5 in our Ubuntu system using following commands.

    # sudo apt-get update
    # sudo apt-get install postgresql postgresql-contrib
    

    Step 3: Connect to PostgreSQL

    After installing PostgreSQL database server, by default it creates a user ‘postgres’. So to connect to postgres server use following command:

    # sudo su - postgres
    # psql
    

    To check login info use following command from database command prompt.

    postgres-# \conninfo
    

    You may create password for user postgres for security purpose.

    postgres=# \password postgres
    

    Now you are ready to use PostgreSQL server.

    Enjoy it!

    No Responses

    Leave a Reply

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

    This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

    The reCAPTCHA verification period has expired. Please reload the page.