2012-02-29 142 views
0

今天我嘗試這個指南在我的共享主機安裝管理平臺安裝管理平臺:錯誤在共享主機

http://unixserveradmin.com/archives/691

但我被困在安裝mysql的寶石。

[[email protected] ~]$ gem install mysql -with-mysql-config=/user/bin/mysql_config 
Fetching: mysql-2.8.1.gem (100%) 
Building native extensions. This could take a while... 
ERROR: Error installing mysql: 
ERROR: Failed to build gem native extension. 

/usr/bin/ruby extconf.rb 
checking for mysql_ssl_set()... no 
checking for rb_str_set_len()... no 
checking for rb_thread_start_timer()... no 
checking for mysql.h... no 
checking for mysql/mysql.h... no 
*** 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. 

Provided configuration options: 
--with-opt-dir 
--without-opt-dir 
--with-opt-include 
--without-opt-include=${opt-dir}/include 
--with-opt-lib 
--without-opt-lib=${opt-dir}/lib 
--with-make-prog 
--without-make-prog 
--srcdir=. 
--curdir 
--ruby=/usr/bin/ruby 
--with-mysql-config 
--without-mysql-config 


Gem files will remain installed in /home/trebolbi/th-mysql-config=/user/bin/mysql_config/gems/mysql-2.8.1 for inspection. 
Results logged to /home/trebolbi/th-mysql-config=/user/bin/mysql_config/gems/mysql-2.8.1/ext/mysql_api/gem_make.out 

問題是更大的,但因爲有我的服務器,一個在我的本地主文件夾,一個服務器的bin文件夾上2個安裝。

這使得命令不會沒有錯誤地執行。

例如,對於這一步:

  1. 登錄到SSH,運行「耙寶石:安裝」從Ruby的應用程序路徑

我得到這個錯誤...

[[email protected] RedMine]$ rake gems:install 
/usr/bin/rake:16:in `load': no such file to load -- rake (LoadError) 
from /usr/bin/rake:16 

如果我嘗試使用我的本地安裝執行命令:

[[email protected] RedMine]$ ./../../ruby/gems/bin/rake gems:install 

我收到很多錯誤,所有與「Gem :: SourceIndex#add_spec從/usr/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:91調用」相關的錯誤。 ...正如你所看到的,它會在服務器bin directoy(/ usr/local/bin)中查找gem,而不是在本地用戶安裝ruby(/ home/user/ruby​​/gems/bin)中。

我只是要執行這個命令來獲取安裝完成...

gem install mysql 
cd /home/trebolbi/rails_apps/RedMine 
rake gems:install 
rake generate_session_store 
RAILS_ENV=production rake db:migrate 
RAILS_ENV=production rake redmine:load_default_data 

,我想從我的帳戶,並與我的本地Ruby安裝執行它們,但我得到所有這些錯誤.. 。 我究竟做錯了什麼?

回答

1

Firtsly,檢查你的ruby版本($ ruby -v)是否與Redmine完全兼容。您可以檢查兼容性RedmineInstall - 這不會解決您當前的問題,但可能有助於避免其他問題。

根據gem的安裝問題,你應該安裝mysql的頭文件,gem工具寫的是mysql.h沒有找到。如果您有權在服務器上安裝軟件,則可以執行此操作。如果你是,使用你的包管理器(yum,apt-get,pacman - 取決於你的操作系統),只需安裝mysql開發包(可以命名爲libmysqlmysql-devel,谷歌它爲您的操作系統)。如果您沒有安裝軟件的權限,請編寫一個查詢來支持要求安裝mysql開發庫。

爲了解決耙子問題,請嘗試使用bundler gem。你可以在那裏找到更多關於它的信息:http://gembundler.com/。在將所有需要的記錄添加到Gemfile之後,您可能希望包含rake,mysql和其他寶石,請運行bundle install。在所有這些操作之後,您可以安全地運行bundle exec rake以正確執行bundler的gem。

讓我知道如果您有任何問題。

+0

我沒有使用捆綁軟件寶石,但因爲它看起來也是一個正確的答案,所以我會將其設置爲我接受的答案!我使用絕對路徑的寶石順便說一句,這件事幾乎是什麼。謝謝! – RodrigoCR 2012-03-16 06:42:15