Skip to content

Instantly share code, notes, and snippets.

@sibosend
Last active November 27, 2018 04:38
Show Gist options
  • Save sibosend/36616f742c3da0d307863a803d1de5c0 to your computer and use it in GitHub Desktop.
Save sibosend/36616f742c3da0d307863a803d1de5c0 to your computer and use it in GitHub Desktop.
Upgrade postgresql from 95 to 96 on Opensuse 42
# currently installed postgresql cluster 9.5
systemctl stop postgresql
# install new version
zypper install postgresql96 postgresql96-contrib postgresql96-devel postgresql96-plpython
postgresql96-pltcl postgresql96-server
# check positions
which pg_upgrade
which postgres
# old bindir
/usr/lib/postgresql95/bin
# new bindir
/usr/lib/postgresql96/bin
# old datadir
/var/lib/pgsql/data
# new datadir
/var/lib/pgsql/data96
# new version initdb
which initdb
su postgres
initdb -D /var/lib/pgsql/data96
# pg_upgrade (postgresql96)
su postgres
cd ~
pg_upgrade --old-bindir=/usr/lib/postgresql95/bin --new-bindir=/usr/lib/postgresql96/bin
--old-datadir=/var/lib/pgsql/data --new-datadir=/var/lib/pgsql/data96 --check
pg_upgrade --old-bindir=/usr/lib/postgresql95/bin --new-bindir=/usr/lib/postgresql96/bin
--old-datadir=/var/lib/pgsql/data --new-datadir=/var/lib/pgsql/data96
cp data/postgresql.conf data96/postgresql.conf
cp data/pg_hba.conf data96/pg_hba.conf
# if everything works well
su postgres
cd ~
mv data data95
mv data96 data
systemctl start|status postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment