Postgres 9.4 to 9.5 database migration x Fedora 24

Fedora changed major versions of the postgresql database package, meaning that all user databases have to migrated from the 9.4.x series that used to be the default, to the 9.5.x series that is the current upstream stable package.

Fedora 24 -> 9.5.3
Fedora 23 -> 9.4.5
Fedora 22 -> 9.4.1

The general plan is to use the postgres tool pg_upgrade, ie take a empty database created with the new database, and populate it with the data from the old database.

So, the first step is to install both the current postgres package, and the previous version of the postgres package from the older Fedora release. For this purposes, the 9.4.x series.

Use the PostgreSQL Yum repository. From that index, select PostgreSQL 9.4 running on Fedora 24 – x86_64. The download file is: pgdg-fedora94-9.4-4.noarch.rpm.

rpm -ivh pgdg-fedora94-9.4-4.noarch.rpm

Refresh dnf cache and install postgres 9.4 package.

dnf list | grep postgresql;
dnf install postgresql94-server postgresql94-contrib;

This installs postgres version 9.4 into /usr/pgsql-9.4/bin/postgres.

Via the information page for the repository referenced above:

/usr/pgsql-9.4/bin/postgresql94-setup initdb
systemctl enable postgresql-9.4.service
systemctl start postgresql-9.4.service 

After this, finished with setup. Use this excellent blog post about upgrading, starting with item 3.