mod_railsインストール

>gem install passenger
>passenger-install-apache2-module
Welcome to the Passenger Apache 2 module installer.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.
1
Checking for required software...

 * GNU C++ compiler... not found
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 * RubyGems... found
 * Rake... found at /usr/bin/rake
 * Apache 2... found at /usr/sbin/httpd2
 * Apache 2 development headers... not found
 * Apache Portable Runtime (APR) development headers... not found
 * fastthread... found

Some required software is not installed.
But don't worry, this installer will tell you how to install them.

Press Enter to continue, or Ctrl-C to abort.

GNU C++ compiler(gcc c++)、Apache 2 development headers(apache2 devel)、Apache Portable Runtime (APR) development headersがないって言われるから、yastでインストールする。

もう一回

linux-dpdk:/usr/lib/ruby/gems/1.8/gems # passenger-install-apache2-module
Welcome to the Passenger Apache 2 module installer.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.
1
Checking for required software...

 * GNU C++ compiler... found at /usr/bin/g++
 * Ruby development headers... found
 * OpenSSL support for Ruby... found
 * RubyGems... found
 * Rake... found at /usr/bin/rake
 * Apache 2... found at /usr/sbin/httpd2-prefork
 * Apache 2 development headers... found at /usr/sbin/apxs2
 * Apache Portable Runtime (APR) development headers... found
 * fastthread... found
--------------------------------------------

--------------------------------------------
Compiling and installing Apache 2 module...
cd /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1
rake clean apache2
(in /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1)
### In ext/apache2:
rm -rf Utils.o Logging.o Configuration.o Hooks.o mod_passenger.o mod_passenger.so

### In ext/passenger:
make clean
rm -f Makefile

### In ext/boost/src:
rm -f libboost_thread.a *.o

### In test:
rm -f Apache2ModuleTests *.o

### In benchmark:
rm -f DummyRequestHandler

### In ext/boost/src:
g++ -O2 -fPIC -I../.. -D_REENTRANT -DNDEBUG  -c *.cpp
ar cru libboost_thread.a *.o
ranlib libboost_thread.a

### In ext/apache2:
g++ -D_REENTRANT -Wall -g -I/usr/local/include  -fPIC -g -DPASSENGER_DEBUG -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/apr-1 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -fPIC -Wall -fno-strict-aliasing -DLDAP_DEPRECATED -I/usr/include/apache2 -I.. -c mod_passenger.c

### In ext/apache2:
g++ -D_REENTRANT -Wall -g -I/usr/local/include  -fPIC -g -DPASSENGER_DEBUG -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/apr-1 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -fPIC -Wall -fno-strict-aliasing -DLDAP_DEPRECATED -I/usr/include/apache2 -I.. -c Utils.cpp

### In ext/apache2:
g++ -D_REENTRANT -Wall -g -I/usr/local/include  -fPIC -g -DPASSENGER_DEBUG -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/apr-1 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -fPIC -Wall -fno-strict-aliasing -DLDAP_DEPRECATED -I/usr/include/apache2 -I.. -c Logging.cpp

### In ext/apache2:
g++ -D_REENTRANT -Wall -g -I/usr/local/include  -fPIC -g -DPASSENGER_DEBUG -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/apr-1 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -fPIC -Wall -fno-strict-aliasing -DLDAP_DEPRECATED -I/usr/include/apache2 -I.. -c Configuration.cpp

### In ext/apache2:
g++ -D_REENTRANT -Wall -g -I/usr/local/include  -fPIC -g -DPASSENGER_DEBUG -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -pthread -I/usr/include/apr-1 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -fPIC -Wall -fno-strict-aliasing -DLDAP_DEPRECATED -I/usr/include/apache2 -I.. -c Hooks.cpp

### In ext/apache2:
g++ -shared Utils.o Logging.o Configuration.o Hooks.o mod_passenger.o -fPIC -o mod_passenger.so   -lstdc++ -lpthread ../boost/src/libboost_thread.a -laprutil-1 -lldap -llber -ldb-4.5 -lexpat -lapr-1 -lrt -lcrypt -lpthread -ldl
/usr/lib/gcc/i586-suse-linux/4.2.1/../../../../i586-suse-linux/bin/ld: cannot find -lldap
collect2: ld returned 1 exit status
rake aborted!
Command failed with status (1): [g++ -shared Utils.o Logging.o Configuratio...]
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/Rakefile:132
(See full trace by running task with --trace)

--------------------------------------------
It looks like something went wrong

Please read our Users guide for troubleshooting tips:

   /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/doc/Users guide.html

If that doesn't help, please use our support facilities at:

   http://www.modrails.com/

We'll do our best to help you.
linux-dpdk:/usr/lib/ruby/gems/1.8/gems # 

なんかまたエラー。
調べてみた。
libldap.soファイルがないらしい。たぶん。
どうもOpenSuseの場合、/usr/lib/libldap-2.3.so.0 はあるけど、libldap.soはないみたい。
たぶんOpenLdapのプリインストールバージョンが2系だから。
とりあえずシンボリックリンクはって見る。

ln -s /usr/lib/libldap-2.3.so.0 /usr/lib/libldap.so

そしたら今度は、liblber.soがないって。もうOpenLdapのばか。

ln -s /usr/lib/liblber-2.3.so.0 /usr/lib/liblber.so
中略
### In ext/passenger:
make
gcc -I. -I/usr/lib/ruby/1.8/i586-linux -I/usr/lib/ruby/1.8/i586-linux -I.  -fPIC -O2 -march=i586 -mtune=i686 -fmessage-length=0 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -g -g -fno-strict-aliasing  -fPIC  -c native_support.c
native_support.c: In function ‘send_fd’:
native_support.c:43: warning: unused variable ‘fd’
gcc -shared -o native_support.so native_support.o -L'.' -L'/usr/lib' -Wl,-R'/usr/lib' -L.  -rdynamic -Wl,-export-dynamic    -Wl,-R -Wl,/usr/lib -L. -L/usr/lib -lruby  -ldl -lcrypt -lm   -lc


--------------------------------------------
The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/ext/apache2/mod_passenger.so
   RailsSpawnServer /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/bin/passenger-spawn-server
   RailsRuby /usr/bin/ruby

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!

Press ENTER to continue.



--------------------------------------------
Deploying a Ruby on Rails application: an example

Suppose you have a Ruby on Rails application in /somewhere. Add a virtual host
to your Apache configuration file, and set its DocumentRoot to
/somewhere/public, like this:

   <VirtualHost *:80>
      ServerName www.yourhost.com
      DocumentRoot /somewhere/public
   </VirtualHost>

And that's it! You may also want to check the Users Guide for security and
optimization tips and other useful information:

  /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/doc/Users guide.html

Enjoy Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/

入った入った!
OpenSUSEじゃなきゃもっと簡単だったろうな。。

んで、こんなファイルを作成して配置。
/etc/apache2/conf.d/testapp.conf

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/ext/apache2/mod_passenger.so
RailsSpawnServer /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/bin/passenger-spawn-server
RailsRuby /usr/bin/ruby

<VirtualHost *:80>
   ServerName www.yourhost.com
   DocumentRoot /home/user_name/www/testapp/public
</VirtualHost>

で、/etc/apache2/httpd.confの以下を修正。(どうもapache2.2系の場合、必要らしい)

<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all ← これをコメントアウト
</Directory>

そんでアパッチスタートしたらきたよ!すげーよ!