1.バックアップ
su - postgres
pg_dumpall -c > backup.dump
2.postgresqlのリポジトリをyumに登録
su -
wget https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-centos10-10-2.noarch.rpm
rpm -ivh pgdg-centos10-10-2.noarch.rpm
vi /etc/yum.repos.d/CentOS-Base.repo
# [base] と [updates]セクションにexclude=postgresql*を追加
3.postgresql10のインストール
yum install postgresql10-server
4.旧バージョンのDB停止
/etc/rc.d/init.d/postgresql stop
5.初期データ作成
su - postgres
/usr/pgsql-10/bin/initdb -D /var/lib/pgsql/10/data
6.新バージョンのDB起動
su -
/etc/rc.d/init.d/postgresql-10 start
7.サービス設定変更
chkconfig --list
chkconfig postgresql off
chkconfig postgresql-10 on
8.ログイン確認
su - postgres
/usr/pgsql-10/bin/psql -U postgres
9.データのリストア
/usr/pgsql-10/bin/psql -d postgres -f backup.dump