-1

I need to install postgres server 11 on ubuntu linux.

because it is recommended during the installation of postgres-11 and apache-age from source code:

i used this command in ubuntu linux

sudo apt install postgresql-server-dev-11

but it gives error:

Unable to locate package postgresql-server-dev-11

can someone please help me

  • **ADD answers to following as update to question**. 1)What version of Ubuntu? 2)What repo are you fetching from? 3) Why Postgres version 11 which goes EOL in November of this year(2023), instead of a newer version? – Adrian Klaver Mar 18 '23 at 16:27
  • I'm using ubuntu version 22.04, postgres 11 because apache age is only compatible with postgres 11 and 12 for now. I have written the command which I have used. – Muhammad Farooq Mar 18 '23 at 17:47
  • You did not answer 2) from my original comment. I'm going to assume you are using the Ubuntu repo included with the distribution. In that repo the only version of Postgres available is 14 per [Ubuntu 22.04 database packages](https://packages.ubuntu.com/jammy/database/). That is version that Ubuntu 'pins' to 22.04. To use other versions you will need to add the Postgres community repos here [PGDG Ubuntu](https://www.postgresql.org/download/linux/ubuntu/). Follow the instructions at the link. Then you will access to all the currently supported Postgres versions. – Adrian Klaver Mar 18 '23 at 19:40

4 Answers4

0

On Ubuntu (apt), only these two packages are currently available:

postgresql-server-dev-12 - development files for PostgreSQL 12 server-side programming
postgresql-server-dev-all - extension build tool for multiple PostgreSQL versions

So, you can install postgreSQL 12 along with postgresql-server-dev-12

But it is not necessary to install the postgresql-server-dev-xx package anymore, as the installation of PostgreSQL should already include all the necessary header files.

The standard installation provides all the header files needed for client application development as well as for server-side program development, such as custom functions or data types written in C.

This change was introduced in PostgreSQL 9.2, where the pg_config script was updated to include the necessary compiler and linker flags, so extensions can be built against the PostgreSQL installation without the need for additional packages.

Mohayu Din
  • 433
  • 9
  • This is incorrect answer as 1) Packages available will depend on what version of Ubuntu you are using if you are using the Ubuntu repos. If you are using the PGDG(Postgres community) repos then all current versions are available and non-current if you use the archive repo. 2) `postgresql-server-dev-12` is needed to build extension. Try building without it. – Adrian Klaver Mar 18 '23 at 20:57
  • Also for Ubuntu 22.04(the version the OP is using) the Ubuntu repo Postgres version is 14 per [Ubuntu 22.04 database packages](https://packages.ubuntu.com/jammy/database/). – Adrian Klaver Mar 18 '23 at 21:10
0

This is probably happening because your version of Ubuntu does not have this package available. You could add the PostgreSQL package repository on your system, add the GPG key of it, and then update the package list. Just use these commands:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-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 apt update

And then run your code

sudo apt install postgresql-server-dev-11

Here's my reference Setup PostgreSQL 11

Wendel
  • 763
  • 1
  • 12
0

Actually, this sudo apt install postgresql-server-dev-xx command varies with the version of Ubuntu.

Here are some examples:-

Package postgresql-server-dev-10: ubuntu0.18.04.1

Package postgresql-server-dev-12: ubuntu0.20.04.1

Package postgresql-server-dev-14: ubuntu0.22.04.1

Package postgresql-server-dev-all: This will cover almost all versions of ubuntu

For more details you can you can refer: Ubuntu-Package Search

-1

Maybe directory where you have installed PostgreSQL with different name. The path you have installed PostgreSQL is specified when you used the ./configure --prefix={path} command during the installation process. It is commonly stored in /usr/local/ but that will depend on where you have specified the path to be.