Postgresql 9.2 on Centos 5, rails, bundle - PostgreSQL is too old [closed]

一笑奈何 提交于 2019-12-24 12:18:12

问题


This is driving me nuts

First, my hosting provider that I have been with since the stone age, are dragging their feet about updating to Centos 6 and, from what I have read, I can see why.

Instead of waiting for the next ice age to pass, I read the instructions for just updating postgresql 9.2 on Centos 5, which is all I need to run my bundle install, which tells me that my PostgreSQL is too old - PostgreSQL 8.1.23

After updating and starting, here's the message back:

[root@vps data]# /etc/init.d/postgresql-9.2 start
/etc/rc.d/init.d/functions: fork: Cannot allocate memory
/etc/profile.d/lang.sh: line 53: /sbin/consoletype: Argument list too long
Starting postgresql-9.2 service:                           [  OK  ]

It started, great - right?

No,

[root@vps data]# psql --version
psql (PostgreSQL) 8.1.23
contains support for command-line editing

If 9.2 started, then why does it still say 8.1.23?

Maybe I just need to reboot

reboot -i

ssh back in psql --version still shows PostgreSQL 8.1.23 - WTF?

I run /etc/init.d/postgresql-9.2 start - it starts - OK, cool

bundle install

Make sure that `gem install pg -v '0.17.1'` succeeds before bundling

gem install pg -v '0.17.1'

I still receive the error:

checking for PQconnectionUsedPassword()... no
Your PostgreSQL is too old. Either install an older version of this gem or upgrade your    database.
*** extconf.rb failed ***

So, my ultimate questions are:

If the postgresql 9.2 started, why does it say that I am running 8.1.23?

Do I have to rm -rf the entire /usr/bin/psql and start over?


回答1:


The PostgreSQL Development Group has packages for Pg 9.3 on CentOS 5.

See yum.postgresql.org.

However, installing Pg 9.3 won't remove 8.1. It'll still be on your PATH. It'll still be running, too.

If you want to use the 9.3 psql and libpq, you need to alter your PATH and LD_LIBRARY_PATH to prefer the PostgreSQL 9.3 install. Then rebuild the Pg gem against the new libpq.

Something like:

export PATH="/usr/pgsql-9.3/bin:$PATH"
export LD_LIBRARY_PATH="/usr/pgsql-9.3/lib/:$LD_LIBRARY_PATH"
gem uninstall pg
gem install pg

If you want this to take effect globally you can modify /etc/ld.so.conf to put the new path in place by default, and /etc/environment to set the PATH appropriately.

Otherwise, add the first two lines to your ~/.bash_profile.

Separately, these are rather worrying:

/etc/rc.d/init.d/functions: fork: Cannot allocate memory
/etc/profile.d/lang.sh: line 53: /sbin/consoletype: Argument list too long

as they suggest something is mismatched/broken on the system. Not necessarily PostgreSQL related. Have you force-installed any RPMs or used any 3rd party repos?



来源:https://stackoverflow.com/questions/22626366/postgresql-9-2-on-centos-5-rails-bundle-postgresql-is-too-old

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!