Skip to content

Latest commit

 

History

History
53 lines (50 loc) · 1.24 KB

upgrade.md

File metadata and controls

53 lines (50 loc) · 1.24 KB

Upgrade postgresql from 9.5 to 11 on Ubuntu 16.10

  1. Create a backup
$ pg_dumpall > <backup_output_file>
  1. Install Postgres 11 Create a pgdg.list
$ sudo vi /etc/apt/sources.list.d/pgdg.list

Add the repo based on version

deb http://apt.postgresql.org/pub/repos/apt/ YOUR_UBUNTU_VERSION_HERE-pgdg main

Then install

$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-11

Run pg_lsclusters

$ pg_lsclusters

Upon running of pg_lsclusters there will be a cluster main for postgres 11 alt text

Stop the 11 cluster

$ sudo pg_dropcluster 11 main --stop

Make sure to stop all processes and services

$ sudo systemctl stop postgresql 

Upgrade the 9.5 cluster

$ sudo pg_upgradecluster -m upgrade 9.5 main

Start postgresql

$ sudo systemctl start postgresql

Check data before removing the old version. If it's all good, then do a

$ sudo pg_dropcluster 9.5 main --stop

Reference: