# Install Postgresql 11

**URL:** <https://travis-ci.community/t/install-postgresql-11/3894>\
**Category:** Travis CI Discussions & Feedback\
**Created:** [June 25, 2019, 9:46am UTC](https://travis-ci.community/t/install-postgresql-11/3894 "2019-06-25T09:46:33Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![tristanbes](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/tristanbes/32/2079_2.png) [@tristanbes](https://travis-ci.community/u/tristanbes)\
**Post date:** [June 25, 2019, 9:46am UTC](https://travis-ci.community/t/install-postgresql-11/3894/1 "2019-06-25T09:46:33Z")

</div>

Hello,

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:

```auto
addons:
    postgresql: '11'
    apt:
        packages:
            - postgresql-11
            - postgresql-client-11

```

but the error is :

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

```

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [June 26, 2019, 8:12pm UTC](https://travis-ci.community/t/install-postgresql-11/3894/2 "2019-06-26T20:12:22Z")

</div>

Please link to the build.

This looks analogous to [Port 10010 is used by docker-containerd](https://travis-ci.community/t/port-10010-is-used-by-docker-containerd/3865) but have to see the build log to see which environment is affected.

---

<div class="post-metadata">

**Author:** ![tristanbes](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/tristanbes/32/2079_2.png) [@tristanbes](https://travis-ci.community/u/tristanbes)\
**Post date:** [June 27, 2019, 2:11pm UTC](https://travis-ci.community/t/install-postgresql-11/3894/3 "2019-06-27T14:11:31Z")

</div>

Raw log can be found there: [https://gist.github.com/tristanbes/4c7d6aa192b254e6460a46c4951ba1bf](https://gist.github.com/tristanbes/4c7d6aa192b254e6460a46c4951ba1bf)

---

<div class="post-metadata">

**Author:** ![tristanbes](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/tristanbes/32/2079_2.png) [@tristanbes](https://travis-ci.community/u/tristanbes)\
**Post date:** [June 27, 2019, 2:32pm UTC](https://travis-ci.community/t/install-postgresql-11/3894/4 "2019-06-27T14:32:44Z")

</div>

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 ☹

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [June 27, 2019, 9:42pm UTC](https://travis-ci.community/t/install-postgresql-11/3894/5 "2019-06-27T21:42:57Z")

</div>

This is a problem with the `postgresql-common` APT package. [https://gist.github.com/tristanbes/4c7d6aa192b254e6460a46c4951ba1bf#file-postgres11-log-L511-L551](https://gist.github.com/tristanbes/4c7d6aa192b254e6460a46c4951ba1bf#file-postgres11-log-L511-L551) :

```auto
Configuring postgresql-common
<...>
 * Starting PostgreSQL 9.2 database server

```

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

```auto
Maintainer: Debian PostgreSQL Maintainers <team+postgresql@tracker.debian.org>

```

Looks like you can also report stuff at [https://tracker.debian.org/pkg/postgresql-common](https://tracker.debian.org/pkg/postgresql-common) .

* * *

[A workaround would be](https://travis-ci.org/native-api/test_travis/jobs/551521928/config) not to use `addons:` and `services:` and instead install `postgresql-common`, stop DB servers, then install Postgresql 11 package by hand:

```auto
install:
  - 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
```

---

<div class="post-metadata">

**Author:** ![akrherz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/akrherz/32/367_2.png) [@akrherz](https://travis-ci.community/u/akrherz)\
**Post date:** [July 1, 2019, 5:37pm UTC](https://travis-ci.community/t/install-postgresql-11/3894/6 "2019-07-01T17:37:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [July 1, 2019, 6:48pm UTC](https://travis-ci.community/t/install-postgresql-11/3894/7 "2019-07-01T18:48:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![akrherz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/akrherz/32/367_2.png) [@akrherz](https://travis-ci.community/u/akrherz)\
**Post date:** [July 1, 2019, 6:50pm UTC](https://travis-ci.community/t/install-postgresql-11/3894/8 "2019-07-01T18:50:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [July 1, 2019, 6:51pm UTC](https://travis-ci.community/t/install-postgresql-11/3894/9 "2019-07-01T18:51:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![akrherz](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/akrherz/32/367_2.png) [@akrherz](https://travis-ci.community/u/akrherz)\
**Post date:** [July 1, 2019, 7:34pm UTC](https://travis-ci.community/t/install-postgresql-11/3894/10 "2019-07-01T19:34:58Z")

</div>

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:`

```auto
  - 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:`

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

```

YMMV
