1. MagicESP
  2. Ubuntu Server 22.04
  3. PostgreSQL
  4. Upgrade from PostgreSQL 9.3 on Ubuntu 14.04 to PostgreSQL 9.5 on Ubuntu 16.04

Upgrade from PostgreSQL 9.3 on Ubuntu 14.04 to PostgreSQL 9.5 on Ubuntu 16.04

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