Install Postgresql 11


I’ve been searching on the web for a proper way to install postgresql 11 without any success.

Please can you help us ?

I tried:

    postgresql: '11'
            - postgresql-11
            - postgresql-client-11

but the error is :

Refused to start PostgreSQL 11, because PostgreSQL 9.2 is currently running! You should first stop 9.2 instance...

Please link to the build.

This looks analogous to Port 10010 is used by docker-containerd but have to see the build log to see which environment is affected.

Raw log can be found there:

It’s working on Xenial but not on Precise, though we got error (on Xenial):
SQLSTATE[08006] [7] fe_sendauth: no password supplied

The doc says the user is postgres without password.
and then, if we don’t provide a password we have this error :frowning:

This is a problem with the postgresql-common APT package. :

Configuring postgresql-common
 * Starting PostgreSQL 9.2 database server

apt show postgresql-common shows the following maintainers’ contact:

Maintainer: Debian PostgreSQL Maintainers <>

Looks like you can also report stuff at .

A workaround would be not to use addons: and services: and instead install postgresql-common, stop DB servers, then install Postgresql 11 package by hand:

  - sudo apt-get install -yq --no-install-suggests --no-install-recommends postgresql-common
  - sudo service postgresql stop
  - sudo apt install -yq --no-install-suggests --no-install-recommends postgresql-11 postgresql-client-11
  - sudo service postgresql start 11
1 Like

Hi @native-api, thanks for posting this. Do you still also need to change the default port from 5433 to 5432 to get PostgreSQL 11 listening on that default port?

If you follow the build link that I provided, you’ll see that I started the server without changing any ports.

Yeah, the server will start, but it is on the wrong port for downstream apps to easily work with. Also having trouble getting postgis-2.5 working with this setup. Still thrashing away and will report back if I can somehow manage to get this all to work.

I didn’t change any settings, so it should start on whatever port the apt package configures it with.

For what it is worth, I needed to do the following to my .travis.yml to get PostgreSQL 11 + Postgis 2.5 working.

  • drop the usage of service: and addons: to install/start postgres
  • use dist: xenial

and then for my before_install:

  - sudo service postgresql stop
  - sudo apt-get --yes remove postgresql-10-postgis-2.4
  - sudo apt install -yq --no-install-suggests --no-install-recommends postgresql-11-postgis-2.5-scripts postgresql-11 postgresql-client-11 postgresql-11-postgis-2.5
  - sed -e 's/^port.*/port = 5432/' /etc/postgresql/11/main/postgresql.conf > postgresql.conf
  - sudo chown postgres postgresql.conf
  - sudo mv postgresql.conf /etc/postgresql/11/main
  - sudo cp /etc/postgresql/{10,11}/main/pg_hba.conf
  - sudo service postgresql restart 11

and then for my before_script:

  - export PATH="/usr/lib/postgresql/11/bin:$PATH"
  - psql -c 'CREATE ROLE travis SUPERUSER LOGIN CREATEDB;' -U postgres