sudo apt-get install postgresql-9.5
sudo /etc/init.d/postgresql stop
sudo ln -s /etc/postgresql/9.3/main/postgresql.conf /var/lib/postgresql/9.3/main/postgresql.conf
sudo ln -s /etc/postgresql/9.5/main/postgresql.conf /var/lib/postgresql/9.5/main/postgresql.conf
cd /tmp
sudo -u postgres /usr/lib/postgresql/9.5/bin/pg_upgrade \
--old-datadir=/var/lib/postgresql/9.3/main \
--new-datadir=/var/lib/postgresql/9.5/main \
--old-bindir=/usr/lib/postgresql/9.3/bin \
--new-bindir=/usr/lib/postgresql/9.5/bin
sudo apt-get remove postgresql-9.3
sudo vim /etc/postgresql/9.5/main/postgresql.conf
Change the listen port to 5432
sudo /etc/init.d/postgresql restart
sudo -u postgres ./analyze_new_cluster.sh
pg_lsclusters
sudo -u postgres ./delete_old_cluster.sh
# fix pg_dump version for some machine
sudo apt remove postgresql-client-common
sudo apt install postgresql
pg_dump --version