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

1
  • 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 wiki.postgresql.org/wiki/Apt Commented Oct 5, 2018 at 10:00

3 Answers 3

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)
0
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
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-
    Commented Mar 24, 2022 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
    Commented Mar 25, 2022 at 17:38
1

this works for me

sudo apt-get install postgresql postgresql-client
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
    Commented Mar 22, 2022 at 19:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .