Apache2でPassengerを使ってみる

Apache2のモジュールでお手軽にRailsを動かせるというPassengerをインストールしてみることにしました。そこでちょっとハマった。

Apacheは最初からインストール済みで、まずはRubyGemsを入れるところから始めました。yumで入るかと思ったのですが、初期の設定では無理なようでソースから入れました。(リポジトリを追加したりすればできそう)

次にgemでPassengerをインストール。

# gem install passenger

あとは、rootになってpassenger-install-apache2-moduleを実行するだけでOKだそうです。しかしApacheが見つからないというエラー。どうやら/usr/local/apache2にインストールしていたせいみたい。
ドキュメントには、export APXS2=/usr/local/apache2/bin/apxsを実行すれば大丈夫と書いてありました。やってみるとApacheのディレクトリをちゃんと見てくれるようになりました。
しかし、途中のビルドで以下のようなエラーが・・・

(in /usr/lib/ruby/gems/1.8/gems/passenger-2.2.4)
** Invoke apache2 (first_time)
** Invoke ext/apache2/mod_passenger.so (first_time)
** Invoke ext/apache2/libpassenger_common.a (first_time, not_needed)
** Invoke ext/apache2/libpassenger_common/Utils.o (first_time, not_needed)
** Invoke ext/common/Utils.cpp (first_time, not_needed)
** Invoke ext/common/Utils.h (first_time, not_needed)
** Invoke ext/apache2/libpassenger_common/Logging.o (first_time, not_needed)
** Invoke ext/common/Logging.cpp (first_time, not_needed)
** Invoke ext/common/Logging.h (first_time, not_needed)
** Invoke ext/apache2/libpassenger_common/SystemTime.o (first_time, not_needed)
** Invoke ext/common/SystemTime.cpp (first_time, not_needed)
** Invoke ext/common/SystemTime.h (first_time, not_needed)
** Invoke ext/apache2/libpassenger_common/CachedFileStat.o (first_time, not_needed)
** Invoke ext/common/CachedFileStat.cpp (first_time, not_needed)
** Invoke ext/common/CachedFileStat.h (first_time, not_needed)
** Invoke ext/apache2/libpassenger_common/Base64.o (first_time, not_needed)
** Invoke ext/common/Base64.cpp (first_time, not_needed)
** Invoke ext/common/Base64.h (first_time, not_needed)
** Invoke ext/apache2/ApplicationPoolServerExecutable (first_time, not_needed)
** Invoke ext/common/ApplicationPoolServerExecutable.cpp (first_time, not_needed)
** Invoke ext/common/ApplicationPool.h (first_time, not_needed)
** Invoke ext/common/Application.h (first_time, not_needed)
** Invoke ext/common/StandardApplicationPool.h (first_time, not_needed)
** Invoke ext/common/ApplicationPoolStatusReporter.h (first_time, not_needed)
** Invoke ext/common/MessageChannel.h (first_time, not_needed)
** Invoke ext/common/SpawnManager.h (first_time, not_needed)
** Invoke ext/common/PoolOptions.h (first_time, not_needed)
** Invoke ext/common/StringListCreator.h (first_time, not_needed)
** Invoke ext/common/FileChangeChecker.h (first_time, not_needed)
** Invoke ext/common/SystemTime.h (not_needed)
** Invoke ext/common/CachedFileStat.hpp (first_time, not_needed)
** Invoke ext/apache2/libboost_oxt.a (first_time, not_needed)
** Invoke ext/apache2/libboost_oxt/boost/once.o (first_time, not_needed)
** Invoke ext/boost/src/pthread/once.cpp (first_time, not_needed)
** Invoke ext/apache2/libboost_oxt/boost/exceptions.o (first_time, not_needed)
** Invoke ext/boost/src/pthread/exceptions.cpp (first_time, not_needed)
** Invoke ext/apache2/libboost_oxt/boost/thread.o (first_time, not_needed)
** Invoke ext/boost/src/pthread/thread.cpp (first_time, not_needed)
** Invoke ext/apache2/libboost_oxt/oxt/system_calls.o (first_time, not_needed)
** Invoke ext/oxt/system_calls.cpp (first_time, not_needed)
** Invoke ext/oxt/thread.hpp (first_time, not_needed)
** Invoke ext/oxt/spin_lock.hpp (first_time, not_needed)
** Invoke ext/oxt/backtrace.hpp (first_time, not_needed)
** Invoke ext/oxt/system_calls.hpp (first_time, not_needed)
** Invoke ext/oxt/macros.hpp (first_time, not_needed)
** Invoke ext/oxt/tracable_exception.hpp (first_time, not_needed)
** Invoke ext/oxt/detail/tracable_exception_disabled.hpp (first_time, not_needed)
** Invoke ext/oxt/detail/spin_lock_pthreads.hpp (first_time, not_needed)
** Invoke ext/oxt/detail/tracable_exception_enabled.hpp (first_time, not_needed)
** Invoke ext/oxt/detail/spin_lock_portable.hpp (first_time, not_needed)
** Invoke ext/oxt/detail/backtrace_disabled.hpp (first_time, not_needed)
** Invoke ext/oxt/detail/backtrace_enabled.hpp (first_time, not_needed)
** Invoke ext/oxt/detail/spin_lock_gcc_x86.hpp (first_time, not_needed)
** Invoke ext/apache2/libboost_oxt/oxt/tracable_exception.o (first_time, not_needed)
** Invoke ext/oxt/tracable_exception.cpp (first_time, not_needed)
** Invoke ext/oxt/thread.hpp (not_needed)
** Invoke ext/oxt/spin_lock.hpp (not_needed)
** Invoke ext/oxt/backtrace.hpp (not_needed)
** Invoke ext/oxt/system_calls.hpp (not_needed)
** Invoke ext/oxt/macros.hpp (not_needed)
** Invoke ext/oxt/tracable_exception.hpp (not_needed)
** Invoke ext/oxt/detail/tracable_exception_disabled.hpp (not_needed)
** Invoke ext/oxt/detail/spin_lock_pthreads.hpp (not_needed)
** Invoke ext/oxt/detail/tracable_exception_enabled.hpp (not_needed)
** Invoke ext/oxt/detail/spin_lock_portable.hpp (not_needed)
** Invoke ext/oxt/detail/backtrace_disabled.hpp (not_needed)
** Invoke ext/oxt/detail/backtrace_enabled.hpp (not_needed)
** Invoke ext/oxt/detail/spin_lock_gcc_x86.hpp (not_needed)
** Invoke ext/apache2/libboost_oxt/oxt/backtrace.o (first_time, not_needed)
** Invoke ext/oxt/backtrace.cpp (first_time, not_needed)
** Invoke ext/oxt/thread.hpp (not_needed)
** Invoke ext/oxt/spin_lock.hpp (not_needed)
** Invoke ext/oxt/backtrace.hpp (not_needed)
** Invoke ext/oxt/system_calls.hpp (not_needed)
** Invoke ext/oxt/macros.hpp (not_needed)
** Invoke ext/oxt/tracable_exception.hpp (not_needed)
** Invoke ext/oxt/detail/tracable_exception_disabled.hpp (not_needed)
** Invoke ext/oxt/detail/spin_lock_pthreads.hpp (not_needed)
** Invoke ext/oxt/detail/tracable_exception_enabled.hpp (not_needed)
** Invoke ext/oxt/detail/spin_lock_portable.hpp (not_needed)
** Invoke ext/oxt/detail/backtrace_disabled.hpp (not_needed)
** Invoke ext/oxt/detail/backtrace_enabled.hpp (not_needed)
** Invoke ext/oxt/detail/spin_lock_gcc_x86.hpp (not_needed)
** Invoke ext/apache2/libboost_oxt/oxt/thread.o (first_time, not_needed)
** Invoke ext/oxt/thread.cpp (first_time, not_needed)
** Invoke ext/oxt/thread.hpp (not_needed)
** Invoke ext/oxt/spin_lock.hpp (not_needed)
** Invoke ext/oxt/backtrace.hpp (not_needed)
** Invoke ext/oxt/system_calls.hpp (not_needed)
** Invoke ext/oxt/macros.hpp (not_needed)
** Invoke ext/oxt/tracable_exception.hpp (not_needed)
** Invoke ext/oxt/detail/tracable_exception_disabled.hpp (not_needed)
** Invoke ext/oxt/detail/spin_lock_pthreads.hpp (not_needed)
** Invoke ext/oxt/detail/tracable_exception_enabled.hpp (not_needed)
** Invoke ext/oxt/detail/spin_lock_portable.hpp (not_needed)
** Invoke ext/oxt/detail/backtrace_disabled.hpp (not_needed)
** Invoke ext/oxt/detail/backtrace_enabled.hpp (not_needed)
** Invoke ext/oxt/detail/spin_lock_gcc_x86.hpp (not_needed)
** Invoke ext/apache2/libpassenger_common.a (not_needed)
** Invoke ext/apache2/libboost_oxt.a (not_needed)
** Invoke ext/apache2/mod_passenger.o (first_time)
** Invoke ext/apache2/mod_passenger.c (first_time, not_needed)
** Execute ext/apache2/mod_passenger.o
gcc -Iext -Iext/common -fPIC -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I/usr/include/apr-1 -I/usr/include/apr-1 -I/usr/local/apache2/include -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/apache2/mod_passenger.o -c ext/apache2/mod_passenger.c
** Invoke ext/apache2/Configuration.o (first_time)
** Invoke ext/apache2/Configuration.cpp (first_time, not_needed)
** Invoke ext/apache2/Configuration.h (first_time, not_needed)
** Execute ext/apache2/Configuration.o
g++ -Iext -Iext/common -fPIC -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I/usr/include/apr-1 -I/usr/include/apr-1 -I/usr/local/apache2/include -D_REENTRANT -I/usr/local/include -Wall -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS -o ext/apache2/Configuration.o -c ext/apache2/Configuration.cpp
/usr/local/apache2/include/apr_file_info.h:192: error: ‘apr_ino_t’ does not name a type
rake aborted!
Command failed with status (1): [g++ -Iext -Iext/common -fPIC -DLINUX=2 -D_...]
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:995:in `sh'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1010:in `sh'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1094:in `sh'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/misc/rake/cplusplus.rb:31:in `compile_cxx'
/usr/lib/ruby/gems/1.8/gems/passenger-2.2.4/Rakefile:310
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:238:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:238:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:238:in `synchronize'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

どうやらもう一つ環境変数として、APR_CONFIGも書き出しておかないといけないみたい。

# export APR_CONFIG=/usr/local/apache2/bin/apr-1-config

これで無事にインストール完了しました。

参考
404 Not Found

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です