PostgreSQL 11 インストール

PostgreSQL 10 から 11 へアップデート

cd /usr/local/src
curl -L https://ftp.postgresql.org/pub/source/v11.0/postgresql-11.0.tar.gz -o postgresql-11.0.tar.gz
tar zxvf postgresql-11.0.tar.gz

cd postgresql-11.0
export CFLAGS="-I/opt/openssl-1.1.1/include" LIBS="-L/opt/openssl-1.1.1/lib" LDFLAGS="-L/opt/openssl-1.1.1/lib" PKG_CONFIG="/opt/openssl-1.1.1/lib/pkgconfig" LD_LIBRARY_PATH="/opt/openssl-1.1.1/lib"
./configure --prefix=/opt/pgsql-11 --with-openssl
make
make install

mkdir /opt/pgsql-11/data
chown postgres /opt/pgsql-11/data
su - postgres
/opt/pgsql-11/bin/initdb -D /opt/pgsql-11/data
exit

cd /opt/pgsql-11/data
/opt/openssl-1.1.1/bin/openssl req -new -text -out server.req
/opt/openssl-1.1.1/bin/openssl rsa -in privkey.pem -out server.key
rm -f privkey.pem
/opt/openssl-1.1.1/bin/openssl req -x509 -days 36500 -in server.req -text -key server.key -out server.crt
chmod og-rwx server.key
chown postgres server.key

/opt/pgsql-11/bin/pg_ctl -o "-p 5433" -D /opt/pgsql-11/data -l logfile start

このあたりでバックアップ・リストア ディスク容量が小さいので、試行錯誤して、なんとかリストア完了

/etc/rc.d/init.d/postgresql stop
ln -snf /opt/pgsql-11 /usr/local/pgsql
/etc/rc.d/init.d/postgresql start

ひとまず完了