How to install PostgreSQL 9.5 in Ubuntu 18.04?

22,236

The last supported release that includes postgresql-9.5 in its default repositories is Ubuntu 16.04. Manually download the following two files from the official Ubuntu website:

The two .deb files have been updated to postgresql-client-9.5_9.5.14-0ubuntu0.16.04_amd64.deb and postgresql-9.5_9.5.14-0ubuntu0.16.04_amd64.deb.

Change directories using cd to the directory containing the two .deb files that you downloaded. Run the following commands:

sudo apt install libedit2 libpq5 libssl1.0.0 postgresql-client-common zlib1g libgssapi-krb5-2 libldap-2.4-2 libpam0g libxml2 postgresql-common locales ssl-cert tzdata sysstat 
sudo apt install ./postgresql-client-9.5_9.5.12-0ubuntu0.16.04_amd64.deb ./postgresql-9.5_9.5.12-0ubuntu0.16.04_amd64.deb

Current versions of postgresql-all:

Ubuntu postgresql-all   
18.04   10     
19.10   11     
20.04   12  
20.10   12     
21.04   13   
21.10   13  
22.04   13 
Share:
22,236

Related videos on Youtube

Ondra Žižka
Author by

Ondra Žižka

I am. (See my LinkedIn profile. Open to job offers for USA, Germany, Austria, Switzerland). 2012 update: I'm a company-man, a team-player, a paradigm-shifter and a core-competancy-synergizer. :) PS: I worked for Red Hat / JBoss, so my answers may be biased. Currently work for Swiss Re.

Updated on September 18, 2022

Comments

  • Ondra Žižka
    Ondra Žižka almost 2 years

    I want to install PostgreSQL 9.5. But the available version is 9.6.

    I only need 9.5 to build wal2json against it and test it (requirement because of AWS version).

    • David Foerster
      David Foerster almost 6 years
      How exactly did you determine the PostgreSQL version after installation of postgresql-9.6? Is it possible that you have another installation of PostgreSQL set up on your system in a way that takes precedence over the former?
    • Ondra Žižka
      Ondra Žižka almost 6 years
      Doh! You are right. I had few docker containers running and one was at 5432. However, still, I need 9.5 and the package available is 9.6. I have changed the question accordingly. Thanks.
    • Ondra Žižka
      Ondra Žižka almost 6 years
      Note for whoever compiles against PostgreSQL: Make sure you have the right postgresql-dev-<version> package installed, and not postgresql-dev-all. Also check pg_config output.
  • lacostenycoder
    lacostenycoder over 3 years
    This didn't seem to work for me