19
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

メモ:Bitnami Redmine にプラグインをインストール

Posted at

自分はRedmineに関しては知識が浅く、プラグイン1つインストールするのにかなりハマりました。各種ハマった点と対処方法(「こうしたらうまくいった」というレベル)をメモしています。

環境

  • CentOS 7 minimal
  • Bitnami Redmine 3.3.0-1

インストールしたプラグイン

公式マニュアル

やはり、まずはBitnami Redmine の公式マニュアルを読んでおきましょう。
https://docs.bitnami.com/installer/apps/redmine/#how-to-install-a-plugin-on-redmine

ハマった個所

上記の公式マニュアル通り操作しても、環境によりハマる場合はハマります。。。

ruby関連コマンド(bundleなど)へのパスが通っていない

現象

初っ端からハマったのは、bundle installが実行すらできないということでした。。。

[root@localhost redmine-3.3.0-1]# bundle install
-bash: bundle: コマンドが見つかりません

対処方法

Bitnami Redmine のインストールディレクトリにあるuse_redmineスクリプトを実行し、ruby関連コマンドのパスを通しましょう。

[root@localhost ~]# cd /opt/redmine-3.3.0-1/
[root@localhost redmine-3.3.0-1]# ./use_redmine 
bash-4.2# echo $PATH
/opt/redmine-3.3.0-1/perl/bin:/opt/redmine-3.3.0-1/git/bin:/opt/redmine-3.3.0-1/sqlite/bin:/opt/redmine-3.3.0-1/ruby/bin:/opt/redmine-3.3.0-1/postgresql/bin:/opt/redmine-3.3.0-1/php/bin:/opt/redmine-3.3.0-1/mysql/bin:/opt/redmine-3.3.0-1/apache2/bin:/opt/redmine-3.3.0-1/common/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

bundle install で証明書エラー発生

現象

bundle install実行時、https://rubygems.org/のSSL証明書が確認できない、というエラーが発生。

bash-4.2# cd /opt/redmine-3.3.0-1/apps/redmine/htdocs/
bash-4.2# bundle install --without development test postgresql sqlite --no-deployment
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
application for all non-root users on this machine.
Fetching source index from https://rubygems.org/
Could not verify the SSL certificate for https://rubygems.org/.
There is a chance you are experiencing a man-in-the-middle attack, but most likely your system doesn't have the CA certificates
needed for verification. For information about OpenSSL certificates, see bit.ly/ruby-ssl. To connect without using SSL, edit
your Gemfile sources and change 'https' to 'http'.

対処方法

ここはとにかく「動かす」ことを最優先して、Gemfile内のhttpshttpに編集。

Gemfile
- source 'https://rubygems.org'
+ source 'http://rubygems.org'

本来はopensslや証明書関連のトラブルシューティングを進めるべきだとは思いますが、今回は個人用の環境なので妥協しています。

bundle installnokogiri 1.6.8インストールエラー

現象

nokogiri 1.6.8のインストール時点でエラー発生。

bash-4.2# bundle install --without development test postgresql sqlite --no-deployment
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
application for all non-root users on this machine.
Fetching gem metadata from http://rubygems.org/...........
Fetching version metadata from http://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..
Resolving dependencies....
Installing rake 11.1.2
Using i18n 0.7.0
Using json 1.8.3
Installing minitest 5.8.4
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Installing activesupport 4.2.6
Using builder 3.2.2
Using erubis 2.7.0
Installing mini_portile2 2.1.0
Installing pkg-config 1.1.7
Installing nokogiri 1.6.8 with native extensions

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

    /opt/redmine-3.3.0-1/ruby/bin/ruby extconf.rb --with-opt-dir=/opt/redmine-3.3.0-1/common 
Using pkg-config version 1.1.7
checking if the C compiler accepts -I/opt/redmine-3.3.0-1/common/include/ImageMagick -I/opt/redmine-3.3.0-1/common/include -I/opt/redmine-3.3.0-1/common/include/ImageMagick -I/opt/redmine-3.3.0-1/common/include ... *** 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
        --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=/opt/redmine-3.3.0-1/ruby/bin/ruby
        --help
        --clean
/opt/redmine-3.3.0-1/ruby/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /opt/redmine-3.3.0-1/ruby/lib/ruby/2.1.0/mkmf.rb:571:in `block in try_compile'
        from /opt/redmine-3.3.0-1/ruby/lib/ruby/2.1.0/mkmf.rb:522:in `with_werror'
        from /opt/redmine-3.3.0-1/ruby/lib/ruby/2.1.0/mkmf.rb:571:in `try_compile'
        from extconf.rb:138:in `nokogiri_try_compile'
        from extconf.rb:162:in `block in add_cflags'
        from /opt/redmine-3.3.0-1/ruby/lib/ruby/2.1.0/mkmf.rb:619:in `with_cflags'
        from extconf.rb:161:in `add_cflags'
        from extconf.rb:414:in `<main>'

extconf failed, exit code 1

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

対処方法

エラーメッセージを見る限り、コンパイラ関連のエラーっぽい。類似の現象(macOS)も発見。
よくよく調べてみると、なんとgccが入っていなかった。。。ので、gccをインストール。

bash-4.2# which gcc
which: no gcc in (/opt/redmine-3.3.0-1/perl/bin:/opt/redmine-3.3.0-1/git/bin:/opt/redmine-3.3.0-1/sqlite/bin:/opt/redmine-3.3.0-1/ruby/bin:/opt/redmine-3.3.0-1/postgresql/bin:/opt/redmine-3.3.0-1/php/bin:/opt/redmine-3.3.0-1/mysql/bin:/opt/redmine-3.3.0-1/apache2/bin:/opt/redmine-3.3.0-1/common/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)

bash-4.2# yum -y install gcc

そして再実行。

bash-4.2# bundle install --without development test postgresql sqlite --no-deployment
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this
application for all non-root users on this machine.
Fetching gem metadata from http://rubygems.org/...........
Fetching version metadata from http://rubygems.org/...
Fetching dependency metadata from http://rubygems.org/..
Resolving dependencies...
Using rake 11.1.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.4
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.2.6
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Installing nokogiri 1.6.8 with native extensions
Using rails-deprecated_sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using loofah 2.0.3
Installing rails-html-sanitizer 1.0.3
Installing actionview 4.2.6
Using rack 1.6.4
Using rack-test 0.6.3
Installing actionpack 4.2.6
Using globalid 0.3.6
Installing activejob 4.2.6
Installing mime-types-data 3.2016.0221
Installing mime-types 3.0
Installing mail 2.6.4
Installing actionmailer 4.2.6
Installing actionpack-action_caching 1.1.1
Installing actionpack-xml_parser 1.0.2
Installing activemodel 4.2.6
Using arel 6.0.3
Installing activerecord 4.2.6
Installing addressable 2.4.0
Using bundler 1.10.4
Installing coderay 1.1.1
Installing concurrent-ruby 1.0.2
Installing css_parser 1.3.7
Installing htmlentities 4.3.1
Using thor 0.19.1
Installing railties 4.2.6
Installing jquery-rails 3.1.4
Installing mimemagic 0.3.1
Using mysql2 0.4.2
Installing net-ldap 0.12.1
Installing protected_attributes 1.1.3
Installing ruby-openid 2.3.0
Installing rack-openid 1.4.2
Installing sprockets 3.6.0
Installing sprockets-rails 3.0.4
Installing rails 4.2.6
Installing rbpdf-font 1.19.0
Installing rbpdf 1.19.0
Installing redcarpet 3.3.4 with native extensions
Installing request_store 1.0.5
Installing rmagick 2.15.4 with native extensions
Installing roadie 3.1.1
Installing roadie-rails 1.1.1
Bundle complete! 31 Gemfile dependencies, 56 gems now installed.
Gems in the groups development, test, postgresql and sqlite were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

( ;∀;)

19
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?