简体   繁体   English

使用远程Postgres数据库安装Postgres Gem PG

[英]Postgres Gem PG Install with Remote Postgres Database

I just installed a fresh copy of Ruby 1.9 and Rails 3 on a Debian Squeeze server. 我刚刚在Debian Squeeze服务器上安装了Ruby 1.9和Rails 3的新副本。 The Rails web application will need to connect to a remote Postgres database so I tried to install the Postgres adapter but it appears that the installer is looking for a local PostgreSQL database and and configs that aren't there because the Postgres database lives on a different host. Rails Web应用程序将需要连接到远程Postgres数据库,因此我尝试安装Postgres适配器,但似乎安装程序正在寻找本地PostgreSQL数据库和不存在的配置,因为Postgres数据库位于另一个数据库中主办。

Can someone explain how to install the Postgres adapter when the actual Postgres database lives on a different machine? 当实际的Postgres数据库位于其他计算机上时,有人可以解释如何安装Postgres适配器吗?

Thanks 谢谢

gem1.9.1 install pg


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

/usr/bin/ruby1.9.1 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.

There are missing libraries on your environment. 您的环境中缺少库。 Try to install all of them before you try to install the pg gem. 在尝试安装pg gem之前,请尝试安装所有它们。
Alternatively, if the libs are all installed and you are still getting the same error, try installing the gem specifying the postgres config file with the --with-pg-config command your error is showing above. 或者,如果所有库都已安装,而您仍然遇到相同的错误,请尝试使用--with-pg-config命令安装指定了postgres配置文件的gem,上面显示了您的错误。

gem install pg --with-pg-config=TYPE_HERE_YOUR_postgresql.conf_PATH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM