2013-02-05 113 views
2

我剛安裝了一個Debian擠壓服務器上的Ruby 1.9和Rails 3的新副本。 Rails的Web應用程序需要連接到遠程Postgres數據庫,所以我試圖安裝Postgres的適配器,但它出現安裝程序正在尋找本地PostgreSQL數據庫,並與CONFIGS是不存在,因爲Postgres數據庫裏住在不同的主辦。Postgres的寶石PG安裝與遠程Postgres數據庫

有人能解釋如何在實際Postgres數據庫住在不同的機器上安裝的Postgres適配器?

感謝

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. 

回答

1

有你的環境缺少的庫。在嘗試安裝pg寶石之前,嘗試安裝它們。
或者,如果庫都安裝了,你仍然得到同樣的錯誤,請嘗試安裝寶石指定與--with-pg-config命令你的錯誤上面顯示Postgres的配置文件。

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

沒錯,就是做到了。 apt-get install libpq-dev其他配置信息真的讓我走錯了路。 – Slinky

+0

此答案無用。什麼是TYPE_HERE_YOUR_postgresql.conf_PATH的含義?這是一個jdbc的URL postgres? – Chandru

+0

這意味着替代文本路徑到您的postgresql.conf位置。 – MurifoX