CentOS 安装PostregSQL9.2 同时出现pg安装错误

错误:

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/bin/ruby extconf.rb 
checking for pg_config... no
No pg_config... trying anyway. If building fails, please try again with
 --with-pg-config=/path/to/pg_config
checking for libpq-fe.h... no
Can't find the 'libpq-fe.h header
*** 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.

 

CentOS的系统版本, 如果用yum安装的话5.x版本就会安装较低版本的PostgreSQL 所以我们要升级。不使用yum安装。

1 删除已经有的postgresql 

yum remove postgresql*

 2 安装Postgresql http://wiki.postgresql.org/wiki/YUM_Installation

下载源文件 
curl -O http://yum.postgresql.org/9.1/redhat/rhel-6-i386/pgdg-centos91-9.1-4.noarch.rpm
安装RPM
rpm -ivh pgdg-centos91-9.1-4.noarch.rpm
列出可用的包
yum list postgres*
安装PostgreSQL server
yum install postgresql91-server

 这里你可以自己去找你要的源文件,上面的只是例子, 安装好后相关目录

默认数据库9.0以上
/var/lib/pgsql/9.2/data/
7.x/8.x
/var/lib/pgsql/data/

安装好后,初始化

service postgresql-9.2 initdb
etc/rc.d/init.d/postgresql-9.2 start
chkconfig --list 查看所有后台服务
chkconfig postgresql-9.2 on 开机启动

 开机自动启动

chkconfig postgresql-9.2 on

 最后删除文件

yum erase postgresql91*

3 安装pg

gem install pg -- --with-pg=/usr/pgsql-9.2 --with-pg-config=/usr/pgsql-9.2/bin/pg_config

 参考 http://www.cnblogs.com/echovalley/archive/2012/10/12/2721716.html

解决的方式就是删除rvm 貌似是rvm的编译影响了系统的编译

mv ~/.rvm/usr/lib ~/.rvm/usr/lib_rvm  

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值