9

I am trying to install the following packcage postgresql-server-dev-9.5. Using

sudo apt-get install postgresql-server-dev-9.5

Now, after I run this command I get this error:

Unable to locate package postgresql-server-dev-9.5.

Couldn't find any package by glob 'postgresql-server-dev-9.5'.

Couldn't find any package by regex 'postgresql-server-dev-9.5'

How can I fix this? I use ubuntu 18.04.1

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
Keselme
  • 223
  • 1
  • 2
  • 6
  • If you really want to use this older version of Postgres (it is supported, but not the latest), install it from the Postgres APT repostiory, see https://wiki.postgresql.org/wiki/Apt – Colin 't Hart Oct 05 '18 at 10:00

3 Answers3

11

Ubuntu 18.04 has PostgreSQL 10, so the correct package there is postgresql-server-dev-10:

sudo apt install postgresql-server-dev-10

To determine the major PostgreSQL version in a given release of Ubuntu, find the matching entries in the postgresql-common page on Launchpad. Thus:

  • 19.04 has PostgreSQL 11 (postgresql-server-dev-11)
  • 18.04 and 18.10 have PostgreSQL 10 (postgresql-server-dev-10)
  • 16.04 has PostgreSQL 9.5 (the second part of the version number is significant here; postgresql-server-dev-9.5)
  • 14.04 has PostgreSQL 9.3 (postgresql-server-dev-9.3)
  • 12.04 has PostgreSQL 9.1 (postgresql-server-dev-9.1)
Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
2

There's an extension build tool for multiple PostgreSQL versions if you are unsure what version to install.

Try:

$ apt install postgresql-server-dev-all
TheZeke
  • 121
  • 2
  • I checked it in my system: `apt show postgresql-server-dev-all|grep Depends` Depends: make, postgresql-common (>= 117~), postgresql-server-dev-12 – K-attila- Mar 24 '22 at 16:38
  • Yes - that's the point of it. Without knowing you need postgresql-server-dev-12 you can install postgresql-server-dev-all and it will choose the correct one (which is postgresql-server-dev-12 in your case). Not sure if you downvoted my answer but I don't know why someone would downvote it. – TheZeke Mar 25 '22 at 17:38
1

this works for me

sudo apt-get install postgresql postgresql-client
Devjoseph
  • 11
  • 1
  • While this may work to actually install the server and client it does not provide the libraries required to compile other software against postgresql. There's a special package called 'postgresql-server-dev-all' that can be used if you aren't sure what version to install. – TheZeke Mar 22 '22 at 19:37