如何验证 PostgreSQL 9 是否已在 CentOS 服务器上正确安装?

如何验证 PostgreSQL 9 是否已在 CentOS 服务器上正确安装?

我正在尝试在 CentoOS 服务器上安装 PG(postgres)gem,但它一直说 Postgres 太旧了,即使我已将其升级到 9.1.3(按照此处的说明http://www.davidghedini.com/pg/entry/install_postgresql_9_on_centos)。

我正在使用 CentOS 5.8(和 Ruby 1.9.3)

错误信息如下:

Building native extensions.  This could take a while...
ERROR:  Error installing pg:
    ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby extconf.rb
checking for pg_config... yes
Using config values from /usr/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... yes
checking for PQconnectionUsedPassword()... no
Your PostgreSQL is too old. Either install an older version of this gem or upgrade your database.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

psql --version 确认我的版本:psql(PostgreSQL)9.1.3

我可以确认已安装的软件包:

Setting up Install Process
Package postgresql91-9.1.3-1PGDG.rhel5.x86_64 already installed and latest version
Package postgresql91-devel-9.1.3-1PGDG.rhel5.x86_64 already installed and latest version
Package postgresql91-server-9.1.3-1PGDG.rhel5.x86_64 already installed and latest version
Package postgresql91-libs-9.1.3-1PGDG.rhel5.x86_64 already installed and latest version
Package postgresql91-contrib-9.1.3-1PGDG.rhel5.x86_64 already installed and latest version
Nothing to do

有什么方法可以解决这个问题吗?提前致谢。

答案1

您的 ruby​​ gem 可能正在拾取旧的开发库。通常,您会将 /usr/pgsql-9.0/include/ 添加到您的包含中。

答案2

由于您正在运行最新版本的 PostgreSQL,因此它不太可能真的太旧。我会查看生成该错误的源代码,并查找其中的错误。它是如何计算出 PostgreSQL“太旧”的?

答案3

粘贴自https://stackoverflow.com/questions/15301026/pg-gem-install-fails-saying-version-is-too-old/28284126#28284126

我快要疯了,直到我意识到这一点,postgresql-devel并且postgresql-libs来自8.1.23!!!

$ yum list installed postgres*
Loaded plugins: fastestmirror, security
Installed Packages
postgresql-devel.i386          8.1.23-10.el5_10       installed
postgresql-devel.x86_64        8.1.23-10.el5_10       installed
postgresql-libs.i386           8.1.23-10.el5_10       installed
postgresql-libs.x86_64         8.1.23-10.el5_10       installed

---------------

$ sudo yum install postgresql94-libs
$ sudo yum install postgresql94-devel

$ gem install pg
Successfully installed pg-0.18.1

相关内容