Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i upgrade my Postgresql 9.5 to Postgresql 10 on ubuntu 16.04 [duplicate]

I had a ubuntu machine on which postgresql 9.5 is running with approximately 12 GB of data. Now i want to upgrade my postgresql version from 9.5 to 10. I googled some articals but unable to upgrade and one more thing i do not want to completely uninstall postgres 9.5 and install postgres 10. My postgresql 9.5 settings are:

1-Postgresql config files are at:

/opt/PostgreSQL/9.5/

2- Postgresql 10 installed location

/etc/postgresql/10
like image 325
Manish Yadav Avatar asked Oct 31 '17 06:10

Manish Yadav


1 Answers

The normal process to upgrade on Debian or Ubuntu is this one :

Stop the new updated version of PostreSQL :

service postgresql stop

Drop the new updated version cluster to be sure nothing is inside :

pg_dropcluster --stop 10 main

Then data migration :

pg_upgradecluster -m upgrade 9.5 main

Then stop previous version of PotsgreSQL :

pg_dropcluster 9.5 main --stop

Remove the old version :

apt-get autoremove --purge postgresql-9.5 

Then just restart PostgreSQL, the new version with database migrated :

service postgresql start
like image 128
Hervé Piedvache Avatar answered Oct 28 '22 00:10

Hervé Piedvache