Monday, May 2, 2022

PostgreSQL Upgrade - Fedora 36

 Fedora 36 will upgrade your PostgreSQL database from 13.4~ to 14.1-3.

Since this is a major upgrade it will require that you upgrade your database.

Here is how to do it:

  1. Install the upgrade utilities:  dnf install postgresql-upgrade
  2. Become user postgres:  sudo su - postgres
  3. Rename the data directory:  mv /var/lib/pgsql/data/ /var/lib/pgsql/data_13.4/
  4. As root, initialize your 14.1 database:  sudo postgresql-setup --initdb --unit postgresql
  5. As user postgres, Copy your pg_hba.conf:  cp /var/lib/pgsql/data_13.4/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
  6. To avoid any potential password issues, temporarily change "md5" to "trust" in both pg_hba.conf files
  7. Run the upgrade process:  pg_upgrade -b /usr/lib64/pgsql/postgresql-13/bin/ -B /usr/bin/ -d data_13.4/ -D data
  8. Change "trust" to md5" if you changed in step 6 
  9. Enable your postgresql.service:  sudo systemctl enable postgresql.service
  10. Start your postgresql.service:  sudo systemctl start postgresql.service
  11. Run the analyse_new_cluster.sh script as suggested
  12. Run the delete_old_cluster.sh script as suggested
Note:  When running commands as the postgres user, it is assumed you are running them from the postgres user $home directory.  This will be your location after you enter the command in step 2.  If you for some reason change to another directory from this userid, just remember to enter:  cd $home before entering any postgresql commands - otherwise you may not be able to execute the desired command, or may receive a permission error.

Saturday, April 24, 2021

PostgreSQL Upgrade - Fedora 34

 Fedora 33 will upgrade your PostgreSQL database from 12.6~ to 13.2-6.

Since this is a major upgrade it will require that you upgrade your database.

Here is how to do it:

  1. Install the upgrade utilities:  dnf install postgresql-upgrade
  2. Become user postgres:  sudo su - postgres
  3. Rename the data directory:  mv /var/lib/pgsql/data/ /var/lib/pgsql/data_12.6/
  4. As root, initialize your 13.2 database:  sudo postgresql-setup --initdb --unit postgresql
  5. As user postgres, Copy your pg_hba.conf:  cp /var/lib/pgsql/data_12.6/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
  6. To avoid any potential password issues, temporarily change "md5" to "trust" in both pg_hba.conf files
  7. Run the upgrade process:  pg_upgrade -b /usr/lib64/pgsql/postgresql-12/bin/ -B /usr/bin/ -d data_12.6/ -D data
  8. Change "trust" to md5" if you changed in step 6 
  9. Enable your postgresql.service:  sudo systemctl enable postgresql.service
  10. Start your postgresql.service:  sudo systemctl start postgresql.service
  11. Run the analyse_new_cluster.sh script as suggested
  12. Run the delete_old_cluster.sh script as suggested
Note:  When running commands as the postgres user, it is assumed you are running them from the postgres user $home directory.  This will be your location after you enter the command in step 2.  If you for some reason change to another directory from this userid, just remember to enter:  cd $home before entering any postgresql commands - otherwise you may not be able to execute the desired command, or may receive a permission error.

Wednesday, April 29, 2020

PostgreSQL Upgrade - Fedora 32

Fedora 30 will upgrade your PostgreSQL database from 11.7~ to 12.2-1.

Since this is a major upgrade it will require that you upgrade your database.

Here is how to do it:
  1. Install the upgrade utilities:  dnf install postgresql-upgrade
  2. Become user postgres:  sudo su - postgres
  3. Rename the data directory:  mv /var/lib/pgsql/data/ /var/lib/pgsql/data_11.7/
  4. As root, initialize your 12.2 database:  sudo postgresql-setup --initdb --unit postgresql
  5. As user postgres, Copy your pg_hba.conf:  cp /var/lib/pgsql/data_11.7/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
  6. To avoid any potential password issues, temporarily change "md5" to "trust" in both pg_hba.conf files
  7. Run the upgrade process:  pg_upgrade -b /usr/lib64/pgsql/postgresql-11/bin/ -B /usr/bin/ -d data_11.7/ -D data
  8. Change "trust" to md5" if you changed in step 6 
  9. Enable your postgresql.service:  sudo systemctl enable postgresql.service
  10. Start your postgresql.service:  sudo systemctl start postgresql.service
  11. Run the analyse_new_cluster.sh script as suggested
  12. Run the delete_old_cluster.sh script as suggested
Note:  When running commands as the postgres user, it is assumed you are running them from the postgres user $home directory.  This will be your location after you enter the command in step 2.  If you for some reason change to another directory from this userid, just remember to enter:  cd $home before entering any postgresql commands - otherwise you may not be able to execute the desired command, or may receive a permission error.

Tuesday, April 30, 2019

PostgreSQL Upgrade - Fedora 30

Fedora 30 will upgrade your PostgreSQL database from 10.7~ to 11.2-3.

Since this is a major upgrade it will require that you upgrade your database.

Here is how to do it:
  1. Install the upgrade utilities:  dnf install postgresql-upgrade
  2. Become user postgres:  sudo su - postgres
  3. Rename the data directory:  mv /var/lib/pgsql/data/ /var/lib/pgsql/data_10.7/
  4. As root, initialize your 11.2 database:  sudo postgresql-setup initdb
  5. As user postgres, Copy your pg_hba.conf:  cp /var/lib/pgsql/data_10.7/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
  6. To avoid any potential password issues, temporarily change "md5" to "trust" in both pg_hba.conf files
  7. Run the upgrade process:  pg_upgrade -b /usr/lib64/pgsql/postgresql-10/bin/ -B /usr/bin/ -d data_10.7/ -D data
  8. Change "trust" to md5" if you changed in step 6 
  9. Enable your postgresql.service:  sudo systemctl enable postgresql.service
  10. Start your postgresql.service:  sudo systemctl start postgresql.service
  11. Run the analyse_new_cluster.sh script as suggested
  12. Run the delete_old_cluster.sh script as suggested
Note:  When running commands as the postgres user, it is assumed you are running them from the postgres user $home directory.  This will be your location after you enter the command in step 2.  If you for some reason change to another directory from this userid, just remember to enter:  cd $home before entering any postgresql commands - otherwise you may not be able to execute the desired command, or may receive a permission error.

Wednesday, May 2, 2018

PostgreSQL Upgrade - Fedora 28

Fedora 28 will upgrade your PostgreSQL database from 9.6.~ to 10.3-4.

Since this is a major upgrade it will require that you upgrade your database.

Here is how to do it:
  1. Install the upgrade utilities:  dnf install postgresql-upgrade
  2. Become user postgres:  sudo su - postgres
  3. Rename the data directory:  mv /var/lib/pgsql/data/ /var/lib/pgsql/data_9.6/
  4. As root, initialize your 10.3 database:  sudo postgresql-setup initdb
  5. As user postgres, Copy your pg_hba.conf:  cp /var/lib/pgsql/data_9.6/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf
  6. To avoid any potential password issues, temporarily change "md5" to "trust" in both pg_hba.conf files
  7. Run the upgrade process:  pg_upgrade -b /usr/lib64/pgsql/postgresql-9.6/bin/ -B /usr/bin/ -d data_9.6/ -D data
  8. Change "trust" to md5" if you changed in step 6 
  9. Enable your postgresql.service:  sudo systemctl enable postgresql.service
  10. Start your postgresql.service:  sudo systemctl start postgresql.service
  11. Run the analyse_new_cluster.sh script as suggested
  12. Run the delete_old_cluster.sh script as suggested
Note:  When running commands as the postgres user, it is assumed you are running them from the postgres user $home directory.  This will be your location after you enter the command in step 2.  If you for some reason change to another directory from this userid, just remember to enter:  cd $home before entering any postgresql commands - otherwise you may not be able to execute the desired command, or may receive a permission error.

Tuesday, July 11, 2017

PostgreSQL Upgrade - Fedora 26

Fedora 26 will upgrade your PostgreSQL database from 9.5.~ to 9.6.3-1.

Since this is a major upgrade it will require that you upgrade your database.

Here is how to do it:

  1. Install the upgrade utilities:  dnf install postgresql-upgrade
  2. Become user postgres:  sudo su - postgres
  3. Rename the data directory:  mv /var/lib/pgsql/data/ /var/lib/pgsql/data_9.5/
  4. As root, initialize your 9.6 database:  sudo postgresql-setup initdb
  5. As user postgres, Copy your pg_hba.conf:  cp /var/lib/pgsql/data_9.5/pg_hba.conf/ /var/lib/pgsql/data/pg_hba.conf/
  6. To avoid any potential password issues, temporarily change "md5" to "trust" in both pg_hba.conf files
  7. Run the upgrade process:  pg_upgrade -b /usr/lib64/pgsql/postgresql-9.5/bin/ -B /usr/bin/ -d data_9.5/ -D data
  8. Change "trust" to md5" if you changed in step 6 
  9. Enable your postgresql.service:  sudo systemctl enable postgresql.service
  10. Start your postgresql.service:  sudo systemctl start postgresql.service
  11. Run the analyse_new_cluster.sh script as suggested
  12. Run the delete_old_cluster.sh script as suggested
Note:  When running commands as the postgres user, it is assumed you are running them from the postgres user $home directory.  This will be your location after you enter the command in step 2.  If you for some reason change to another directory from this userid, just remember to enter:  cd $home before entering any postgresql commands - otherwise you may not be able to execute the desired command, or may receive a permission error.

Thursday, June 23, 2016

PostgreSQL Upgrade - Fedora 24

Fedora 24 will upgrade your PostgreSQL database from 9.4.8-1 to 9.5.3-1.

Since this is a major upgrade it will require that you upgrade your database.

Here is how to do it:

  1. Install the upgrade utilities:  dnf install postgresql-upgrade
  2. Become user postgres:  sudo su - postgres
  3. Rename the data directory:  mv /var/lib/pgsql/data/ /var/lib/pgsql/data_9.4/
  4. As root, initialize your 9.5 database:  sudo postgresql-setup initdb
  5. As user postgres, Copy your pg_hba.conf:  cp /var/lib/pgsql/data_9.4/pg_hba.conf/ /var/lib/pgsql/data/pg_hba.conf/
  6. To avoid any potential password issues, temporarily change "md5" to "trust" in both pg_hba.conf files
  7. Run the upgrade process:  pg_upgrade -b /usr/lib64/pgsql/postgresql-9.4/bin/ -B /usr/bin/ -d data_9.4/ -D data
  8. Change "trust" to md5" if you changed in step 6 
  9. Enable your postgresql.service:  sudo systemctl enable postgresql.service
  10. Start your postgresql.service:  sudo systemctl start postgresql.service
  11. Run the analyse_new_cluster.sh script as suggested
  12. Run the delete_old_cluster.sh script as suggested
Note:  When running commands as the postgres user, it is assumed you are running them from the postgres user $home directory.  This will be your location after you enter the command in step 2.  If you for some reason change to another directory from this userid, just remember to enter:  cd $home before entering any postgresql commands - otherwise you may not be able to execute the desired command, or may receive a permission error.