I was recently trying to install Postgresql-10 on my raspberry pi running Stretch. When I run sudo apt-get install postgresql-10 I get

E: Unable to locate package postgresql-10.

However, when I go to the site http://archive.raspbian.org/raspbian/pool/main/p/ I clearly see the directory postgresql-10.

I have performed an sudo apt-get update, so what am I doing wrong?

  • Can you check this command and its output? apt-cache search postgresql – eftshift0 Apr 25 '18 at 20:42
  • @eftshift0 : it's not appearing in that list. – John Smith Apr 26 '18 at 11:36
  • That doesn't sound quite right. Will check on my raspberry when I get back home. – eftshift0 Apr 26 '18 at 14:28
  • Just checked on my raspberry (stretch) and what I see is postgresql-9.6 and 9.5. – eftshift0 Apr 26 '18 at 22:40

A highly useful resource is packages.debian.org in cases like this. If you search up postgresql-10, a package is found, but the key bit to note is the distributions that the package is available in (top right of the page) — it's only available in the Buster and Sid repositories — not Stretch.

That explains why you're seeing the directory in the package repository, despite not being able to access it yourself with your Stretch installation. As you can see in the dists/ directory of the repo, Buster is an available option, so that's why the package has crept in.

You may be able to install some packages from the testing repository while keeping your system mostly stable, but be aware that it's technically not supported. If you want to go down that route, take a read of the Advice For New Users On Not Breaking Their Debian System which is highly informative.


At this point the repository does not contain an officially supported version of PostgreSQL 10. When software releases a major point upgrade, it can often take quite a while for it to get into a repository, as there's a lot of work involved in such a process.

If you want the latest version, you'll have to either be patient, build it yourself (I don't recommend this), or maybe utilize something like docker.

  • If you really really need it and you are using a multi-core model (ARMv7) there might be another distro that has it; Fedora 27 has 9.6.8, you could check Ubuntu or Arch... – goldilocks Apr 26 '18 at 15:33
  • @goldilocks: that is true, my assumption was that they'd want to stick with Raspbian. – Jacobm001 Apr 26 '18 at 15:34

when I go to the site http://archive.raspbian.org/raspbian/pool/main/p/ I clearly see the directory postgresql-10.

The repo likely contains packages from the testing branch (v.10, Buster).

Sometimes it is feasible to install them manually, but it can get pretty tedious (so you might want to try a source build instead first). First:

mkdir deb
cd deb

That's because the package will open up without a tidy toplevel of its own.

wget http://archive.raspbian.org/raspbian/pool/main/p/postgresql-10/postgresql-10_10.3-2_armhf.deb
ar x postgresql-10_10.3-2_armhf.deb

This leaves a couple of .tar.xz files.

tar -xJf control.tar.xz
tar -xJf data.tar.xz

The first one contains a some meta information in text files; control will include a Depends: list which you will need to consider.

The second one will open up into a directory tree rooted at usr in the current directory. If you actually install it, those files are distributed in the root filesystem (i.e., /usr).

You can run ldd on the binaries to see if the system can provide the shared libraries to run. I did not go that far (I don't have anything at hand running Raspbian), but there's a daunting number of shared object in that package, and the service files that are used to control the server (/lib/systemd/system/postgresql.service) must be in some other package...


The only way to install PostgreSQL 10.x for Raspbian is to compile it. I've distilled it down to two bash scripts and two reboots. Like Aurora0001 said, it doesn't work for Stretch (only Jesse), but I hope it helps anyway!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.