下記の環境で古いバージョンのPostgreSQL(8.1.23)をインストールした。
# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
initdbを実行しようとしたところ、下記のエラーが発生し、initdbができなかった。
postgres@test:~$ initdb -D /var/local/pgsql
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale ja_JP.UTF-8.
The default database encoding has accordingly been set to UTF8.
fixing permissions on existing directory /var/local/pgsql ... ok
creating directory /var/local/pgsql/global ... ok
creating directory /var/local/pgsql/pg_xlog ... ok
creating directory /var/local/pgsql/pg_xlog/archive_status ... ok
creating directory /var/local/pgsql/pg_clog ... ok
creating directory /var/local/pgsql/pg_subtrans ... ok
creating directory /var/local/pgsql/pg_twophase ... ok
creating directory /var/local/pgsql/pg_multixact/members ... ok
creating directory /var/local/pgsql/pg_multixact/offsets ... ok
creating directory /var/local/pgsql/base ... ok
creating directory /var/local/pgsql/base/1 ... ok
creating directory /var/local/pgsql/pg_tblspc ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1000
creating configuration files ... ok
creating template1 database in /var/local/pgsql/base/1 ... ok
initializing pg_authid ... FATAL: wrong number of index expressions
child process exited with exit code 1
initdb: removing contents of data directory "/var/local/pgsql"
調べてみると、gcc-4.8と古いPostgreSQLの相性が悪いらしい・・
古いgccを入れてやればいいのかな・・
# yum list | grep gcc
gcc.x86_64 4.8.5-4.el7 @base
gcc-c++.x86_64 4.8.5-4.el7 @base
libgcc.x86_64 4.8.5-4.el7 @base
compat-gcc-44.x86_64 4.4.7-8.el7 base
compat-gcc-44-c++.x86_64 4.4.7-8.el7 base
compat-gcc-44-gfortran.x86_64 4.4.7-8.el7 base
gcc-gfortran.x86_64 4.8.5-4.el7 base
gcc-gnat.x86_64 4.8.5-4.el7 base
gcc-go.x86_64 4.8.5-4.el7 base
gcc-objc.x86_64 4.8.5-4.el7 base
gcc-objc++.x86_64 4.8.5-4.el7 base
gcc-plugin-devel.x86_64 4.8.5-4.el7 base
libgcc.i686 4.8.5-4.el7 base
relaxngcc.noarch 1.12-6.el7 base
relaxngcc-javadoc.noarch 1.12-6.el7 base
とりあえず、yumのリポジトリには古いgccがあるので、やってみる。
古いgccを入れて、gccにsymlinkを作成。
# yum install -y compat-gcc-44
# ln -sfn /usr/bin/gcc44 /usr/bin/gcc
再インストールを行う。
# cd /usr/local/src/postgresql-8.1.23
# ./configure --prefix=/usr/local/postgresql-8.1.23
# gmake
# gmake install
インストールまでは問題なくいけた。
さて、initdbはできるのか・・
$ initdb -D /var/local/pgsql
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale ja_JP.UTF-8.
The default database encoding has accordingly been set to UTF8.
fixing permissions on existing directory /var/local/pgsql ... ok
creating directory /var/local/pgsql/global ... ok
creating directory /var/local/pgsql/pg_xlog ... ok
creating directory /var/local/pgsql/pg_xlog/archive_status ... ok
creating directory /var/local/pgsql/pg_clog ... ok
creating directory /var/local/pgsql/pg_subtrans ... ok
creating directory /var/local/pgsql/pg_twophase ... ok
creating directory /var/local/pgsql/pg_multixact/members ... ok
creating directory /var/local/pgsql/pg_multixact/offsets ... ok
creating directory /var/local/pgsql/base ... ok
creating directory /var/local/pgsql/base/1 ... ok
creating directory /var/local/pgsql/pg_tblspc ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 1000
creating configuration files ... ok
creating template1 database in /var/local/pgsql/base/1 ... ok
initializing pg_authid ... ok
enabling unlimited row size for system tables ... ok
initializing dependencies ... ok
creating system views ... ok
loading pg_description ... ok
creating conversions ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.
Success. You can now start the database server using:
postmaster -D /var/local/pgsql
or
pg_ctl -D /var/local/pgsql -l logfile start
できた!!
備忘録としてメモ。