Redmineをgit pullしてUpdate

redmine_update前の記事でRedmineをgit pullして最新に更新できるようにしたけど、実際やってみたらエラーになったときの覚書

環境: CentOS 6.7, Ruby 2.2.4p230

 


1.Rubyアップデート

rbenvを使ってRubyを2.2.4にアップデート

確認してインストール
# rbenv install -l
# rbenv install 2.2.4
# rbenv global 2.2.4

gem自体をアップデート
# gem update --system

bundlerをインストールし直し
# gem install bundler

確認
# gem list

 


2.Redmineアップデート

実はエラーになってからRuby 2.2.4に上げたので、エラーになった時はRuby 2.2.2。

Redmineのリポジトリに移動してgit pull
# cd /opt/redmine
# git pull

バンドルされているのをアップデート
# bundle update

エラー(下記エラーはRuby 2.2.2でbundle updateしたとき)

Warning: this Gemfile contains multiple primary sources. Using `source` more than once without a block is a security risk, and may result in installing unexpected gems. To resolve this warning, use a block to indicate which gems should come from the secondary source. To upgrade this warning to an error, run `bundle config disable_multisource true`.
Fetching gem metadata from http://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from http://rubygems.org/...
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/..
Resolving dependencies....
Using rake 11.1.2 (was 10.4.2)
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4 (was 5.8.3)
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.5.2 (was 4.2.5)
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.0.0

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /root/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20160420-22231-ima0g.rb extconf.rb --use-system-libraries
checking if the C compiler accepts ... *** 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=/root/.rbenv/versions/2.2.2/bin/$(RUBY_BASE_NAME)
        --help
        --clean
/root/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /root/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
        from /root/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
        from /root/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
        from extconf.rb:80:in `nokogiri_try_compile'
        from extconf.rb:87:in `block in add_cflags'
        from /root/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
        from extconf.rb:86:in `add_cflags'
        from extconf.rb:336:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /opt/redmine/vendor/bundle/ruby/2.2.0/gems/nokogiri-1.6.7.2 for inspection.
Results logged to /opt/redmine/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/nokogiri-1.6.7.2/gem_make.out
An error occurred while installing nokogiri (1.6.7.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.7.2'` succeeds before bundling

 

※ここでRubyを2.2.4にアップデート。

もう一度バンドルされているのをアップデート
# bundle install --without development test --path vendor/bundle

エラー

make "DESTDIR="
compiling houdini_href_e.c
make: gcc: コマンドが見つかりませんでした
make: *** [houdini_href_e.o] エラー 127

gccコマンドがないのでYUM経由でインストール
# yum install gcc

もう一度アップデート
# bundle install --without development test --path vendor/bundle

エラーなく終了

データベースとプラグインをアップデートして、キャッシュをクリア
# bundle exec rake db:migrate RAILS_ENV=production
# bundle exec rake redmine:plugins:migrate RAILS_ENV=production
# bundle exec rake tmp:cache:clear tmp:sessions:clear RAILS_ENV=production

Redmine再起動
# /etc/rc.d/init.d/redmine restart

 

< Related Posts >