Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Install the upgraded version. Below, PostgreSQL 9.6 is installed.
    1. For CentOS 6.x:

      Code Block
      wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-310.noarch.rpm
      sudo yum -y install pgdg-centos96-9.6-310.noarch.rpm
    2. For CentOS 7.x:

      Code Block
      wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-310.noarch.rpm
      sudo yum -y install pgdg-centos96-9.6-310.noarch.rpm
    3. For Red Hat Enterprise Linux 6.x:

      Code Block
      wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-6-x86_64/pgdg-centos96-9.6-310.noarch.rpm
      sudo yum -y install pgdg-redhat96-9.6-310.noarch.rpm
    4. For Red Hat Enterprise Linux 7.x:

      Code Block
      wget https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-centos96-9.6-310.noarch.rpm
      sudo yum -y install pgdg-redhat96-9.6-310.noarch.rpm
  2. Create a new data directory for the new database version:

    1. For CentOS 7.x:

      Code Block
      sudo /usr/pgsql-9.6/bin/postgresql96-setup initdb
    2. For CentOS 6.x, RHEL 6.x:

      Code Block
      sudo service postgresql-9.6 initdb
    3. For RHEL 7.x:

      Code Block
      sudo /usr/pgsql-9.6/bin/postgresql96-setup initdb
  3. Use the following commands to verify that the upgrade is possible:

    Code Block
    su postgres
    cd ~
    /usr/pgsql-9.6/bin/pg_upgrade --old-bindir=/usr/pgsql-9.3/bin/ --new-bindir=/usr/pgsql-9.6/bin/ --old-datadir=/var/lib/pgsql/9.3/data/ --new-datadir=/var/lib/pgsql/9.6/data/ --check 

    If all is well, you should see a Clusters are compatible message.

  4. Stop the old version of the database service as the root user:
    1. CentOS/RHEL:

      Code Block
      sudo service postgresql-9.3 stop
  5. Run the upgrade as the postgres user:
    1. CentOS/RHEL:

      Code Block
      su postgres
      /usr/pgsql-9.6/bin/pg_upgrade --old-bindir=/usr/pgsql-9.3/bin/ --new-bindir=/usr/pgsql-9.6/bin/ --old-datadir=/var/lib/pgsql/9.3/data/ --new-datadir=/var/lib/pgsql/9.6/data/

...