移动后 Redmine 无法启动

移动后 Redmine 无法启动

当我从一台服务器移动到另一台服务器时,我遇到了 redmine(或 ruby​​ 配置)的问题

redmine@dirty:~/www$ ruby script/rails server webrick -e production
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `require': Incorrect MySQL client library version! This gem was compiled for 5.5.17 but the client library is 5.1.59. (RuntimeError)
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'   
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'   
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler.rb:131:in `require'
        from /home/redmine/redmine-2.4/config/application.rb:7:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:53:in `require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:53:in `block in <top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:50:in `tap'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

我使用 mysql2 适配器(因为据我所知,mysql 不能处理数据库中的 utf8 文本)

附加信息:

redmine@d:~/www$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.2.1
  - RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-2.0.0-p353
  - RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-2.0.0-p353/bin
  - SPEC CACHE DIRECTORY: /home/redmine/.gem/specs
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/rvm/gems/ruby-2.0.0-p353
     - /usr/local/rvm/gems/ruby-2.0.0-p353@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/rvm/gems/ruby-2.0.0-p353/bin
     - /usr/local/rvm/gems/ruby-2.0.0-p353@global/bin


root@d:/usr/local/rvm# aptitude search '~imysql'
i   libmysqlclient-dev                            - Percona Server database development files               
i A libmysqlclient16                              - MySQL database client library                           
i A libmysqlclient18                              - Percona Server database client library                  
i   php5-mysql                                    - MySQL module for php5 

redmine@d:~/www$ svn info
Path: .
URL: http://svn.redmine.org/redmine/branches/2.4-stable
Repository Root: http://svn.redmine.org/redmine

我已经多次重新安装了 gem、bundle 甚至 packages,但仍然没有成功。

UPD(建议迈克尔·汉普顿♦):

redmine@d:~/www$ gem pristine --all
Restoring gems to pristine condition...
Restored actionmailer-3.2.16
Restored actionpack-3.2.16
Restored activemodel-3.2.16
Restored activerecord-3.2.16
Restored activeresource-3.2.16
Restored activesupport-3.2.16
Restored arel-3.0.3
Skipped bigdecimal-1.2.0, it is a default gem
Restored builder-3.2.2
Restored builder-3.0.0
Restored bundler-1.5.2
Restored bundler-unload-1.0.2
Restored coderay-1.1.0
Restored daemons-1.1.9
Restored erubis-2.7.0
Building native extensions.  This could take a while...
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/ext/builder.rb:73: warning: Insecure world writable dir /usr/local/rvm/gems/ruby-2.0.0-p353@global/bin in PATH, mode 040777
Restored eventmachine-1.0.3
Building native extensions.  This could take a while...
Restored gem-wrappers-1.2.3
Restored hike-1.2.3
Restored i18n-0.6.9
Skipped io-console-0.4.2, it is a default gem
Restored journey-1.0.4
Restored jquery-rails-2.0.3
Building native extensions with: ''
This could take a while...
Restored json-1.8.1
Skipped json-1.7.7, it is a default gem
Restored mail-2.5.4
Restored mime-types-1.25.1
Skipped minitest-4.3.2, it is a default gem
Restored multi_json-1.8.4
Building native extensions with: ''
This could take a while...
Restored mysql-2.8.1
Building native extensions with: ''
This could take a while...
Restored mysql2-0.3.14
Restored net-ldap-0.3.1
Restored polyglot-0.3.3
Skipped psych-2.0.0, it is a default gem
Restored rack-1.4.5
Restored rack-cache-1.2
Restored rack-openid-1.4.1
Restored rack-ssl-1.3.3
Restored rack-test-0.6.2
Restored rails-3.2.16
Restored railties-3.2.16
Restored rake-10.1.1
Skipped rake-0.9.6, it is a default gem
Skipped rdoc-4.0.0, it is a default gem
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
 = 1.8.7 : gem install rdoc-data; rdoc-data --install
 = 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Restored rdoc-3.12.2
Building native extensions with: ''
This could take a while...
Restored rmagick-2.13.2
Restored ruby-openid-2.3.0
Restored rubygems-bundler-1.4.2
Restored rvm-1.11.3.8
Restored sprockets-2.2.2
Skipped test-unit-2.0.0.0, it is a default gem
Building native extensions.  This could take a while...
Restored thin-1.6.1
Restored thor-0.18.1
Restored tilt-1.4.1
Restored treetop-1.4.15
Restored tzinfo-0.3.38

redmine@d:~/www$ ruby script/rails server webrick -e production
/usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:220: warning: Insecure world writable dir /usr/local/rvm/gems/ruby-2.0.0-p353@global/bin in PATH, mode 040777
/usr/local/rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `require': Incorrect MySQL client library version! This gem was compiled for 5.5.17 but the client library is 5.1.59. (RuntimeError)
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/mysql2-0.3.14/lib/mysql2.rb:8:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `each'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:72:in `block in require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `each'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler/runtime.rb:61:in `require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353@global/gems/bundler-1.5.2/lib/bundler.rb:131:in `require'
        from /home/redmine/redmine-2.4/config/application.rb:7:in `<top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:53:in `require'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:53:in `block in <top (required)>'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:50:in `tap'
        from /usr/local/rvm/gems/ruby-2.0.0-p353/gems/railties-3.2.16/lib/rails/commands.rb:50:in `<top (required)>'
        from script/rails:6:in `require'
        from script/rails:6:in `<main>'

更新2:

在旧系统上,我使用软件包中的 ruby​​,在新的 ubuntu 服务器 11.10 上,我使用 rvm 提供的 ruby

答案1

您正在使用具有本机扩展的 gem,但它们是针对源系统上具有不同版本目标系统上的库进行编译的。

因此您需要在目标系统上重建您的 gem。

rvm use 2.0.0-p353
gem pristine --all

将来你最好部署你的源代码并让 bundler 处理目标系统上的 gem,而不是尝试复制整个 .rvm 目录。

相关内容