20170303_ossdb_silver_教科書_3

postgresqlをインストール

■ユーザーを生成

# useradd postgres
# passwd postgres

■必要なパッケージのインストール

# yum install make 
# yum install gcc
# yum install readline
# yum install zlib
# yum install flex
# yum install bison

上記をインストールしてmakeすると、readlineが見つからないというエラーが発生する。

checking for -lreadline... no
checking for -ledit... no
configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure.  It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.

[see config.log]とあるので、[config.log]を見てみる。

ちなみに、[config.log]は、./configureディレクトリ内に生成される。

[postgresql-9.0.23]# ls
COPYRIGHT       HISTORY  Makefile  aclocal.m4  config.log  configure.in  doc
GNUmakefile.in  INSTALL  README    config      configure   contrib       src

[config.log]の該当箇所

configure:8317: checking for -lreadline
configure:8349: gcc -o conftest -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing -fwrapv -fexcess-precision=standard -fno-aggressive-loop-optimizations  -D_GNU_SOURCE    conftest.c -lreadline -lcrypt -ldl -lm  >&5
/usr/bin/ld: cannot find -lreadline
collect2: error: ld returned 1 exit status
configure:8356: $? = 1
configure: failed program was:

readlineをインストールしているのにreadlineが見つからないいうメッセージが表示されている。

上記エラーについて検索すると、下記の記事が見つかった。

makeで「/usr/bin/ld: cannot find」と表示されるときは − @IT

「それでも同じエラーが出る場合は、xxx-develをインストールする」

開発者ツールがインストールされていないとエラーが発生するようである。

■必要なパッケージのインストール2 下記二つのパッケージをインストールするとmakeできるようになる (2017/3/3時点)

# yum install readline-devel
# yum install zlib-devel

ソースコードを解凍・インストールする

あらかじめ、/optにソースコードをダウンロードする

※教科書に記載のメジャーバージョンの最新版をダウンロードした

# su - postgresql
$ cd /opt/
$ tar xzvf postgresql-9.0.23
$ cd postgresql-9.0.23
$ ,/configure
$ make 
$ su
# make install

インストール完了