Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save vandamon/74d2a537bd15d0b978e8d49c7903c3ce to your computer and use it in GitHub Desktop.

Select an option

Save vandamon/74d2a537bd15d0b978e8d49c7903c3ce to your computer and use it in GitHub Desktop.

Revisions

  1. Ziyan Junaideen created this gist Feb 21, 2017.
    41 changes: 41 additions & 0 deletions install-postgresql-9.6-in-ubuntu-16.04.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    ### Background

    I believe Ubuntu 16.04 comes with PostgreSQL 9.5. Thats good for a start, but it is a matter of time before
    you have the need of a PostgreSQL 9.6 cluster. For me it was to import a PG backup from Heroku.

    The procedure couldn't have been any easier and is described below. If you are interested in upgrading your
    old cluster to 9.6 afterwards, you may be interested in
    [this](https://gist.github.com/ziyan-junaideen/29d72f9292c9b8fdaa333ebea95afd65).

    ### Instructions

    sudo -s 'echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" > /etc/apt/sources.list.d/pgdg.list'

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

    sudo aptitude update

    sudo aptitude install postgresql-9.6 postgresql-client-9.6 postgresql-contrib-9.6

    ### Check

    `dpkg -l | grep postgresql` will give us what is installed and will be some thing like this

    ii postgresql 9.5+173 all object-relational SQL database (supported version)
    ii postgresql-9.5 9.5.5-0ubuntu0.16.04 amd64 object-relational SQL database, version 9.5 server
    ii postgresql-9.6 9.6.2-1.pgdg16.04+1 amd64 object-relational SQL database, version 9.6 server
    ii postgresql-client-9.5 9.5.5-0ubuntu0.16.04 amd64 front-end programs for PostgreSQL 9.5
    ii postgresql-client-9.6 9.6.2-1.pgdg16.04+1 amd64 front-end programs for PostgreSQL 9.6
    ii postgresql-client-common 173 all manager for multiple PostgreSQL client versions
    ii postgresql-common 173 all PostgreSQL database-cluster manager
    ii postgresql-contrib 9.5+173 all additional facilities for PostgreSQL (supported version)
    ii postgresql-contrib-9.5 9.5.5-0ubuntu0.16.04 amd64 additional facilities for PostgreSQL
    ii postgresql-contrib-9.6 9.6.2-1.pgdg16.04+1 amd64 additional facilities for PostgreSQL

    `pg_lsclusters`, will show that your 9.5 and 9.6 main clusters to be "online".

    pg_lsclusters
    Ver Cluster Port Status Owner Data directory Log file
    9.5 main 5432 online postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.5-main.log
    9.6 main 5433 online postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.6-main.log