As the title suggests I want to upgrade my postgresql-10
to postgresql-11
.
I'm using ubuntu-18.04
.
Upgrading Postgres to the latest version (currently 13), or to an intermediate version such as 11, should be done by running:
sudo apt install postgresql-common
sudo sh /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
This is documented on https://wiki.postgresql.org/wiki/Apt
This runs a bash script on your computer. See there if you wish to run the steps manually.
Once you have installed Postgres, the easiest way to upgrade on Ubuntu is with pg_upgradecluster.
sudo -u postgres pg_dumpall > all.sql
// Install latest Postgres. Use `postgresql-11` for v11 instead of `postgresql` for latest.
sudo apt-get install -y postgresql
// The install sets up a cluster, which needs then to be removed for the upgrade.
// Stop and remove the newly installed cluster. Use `11` instead of `13` for v11
sudo pg_dropcluster 13 main --stop
// Upgrade the db. Takes the OLD version and OLD schema as required arguments
sudo pg_upgradecluster 10 main
// Test. Once you are satisfied, remove OLD cluster.
sudo pg_dropcluster 10 main
You can follow this blog setup Postgresql-11 on Ubuntu. I found it easy and simple.
Add the PostgreSQL package repository on your Ubuntu machine
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main 11" | sudo tee /etc/apt/sources.list.d/pgsql.list
Add the GPG key of the PostgreSQL package repository:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Update APT and install postgresql-11
sudo apt update && sudo apt install postgresql-11
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With