2012-02-29 143 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