ubuntu-8.10上安装passenger-2.0.6

按照官方文档上的说明,在ubuntu-8.10上安装passenger时报以下错误:

 passengerWelcome to the Phusion Passenger Apache 2 module installer, v2.0.6.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.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 /opt/ruby-enterprise/bin/rake* Apache 2... found at /usr/sbin/apache2* Apache 2 development headers... found at /usr/bin/apxs2* Apache Portable Runtime (APR) development headers... found at /usr/bin/apr-1-config* Apache Portable Runtime Utility (APR) development headers... found at /usr/bin/apu-1-config* fastthread... found* rack... found----------------------------------------------------------------------------------------Compiling and installing Apache 2 module...cd /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6/opt/ruby-enterprise/bin/ruby -S rake clean apache2/usr/bin/rake:27:in `require': no such file to load -- rake (LoadError)from /usr/bin/rake:27--------------------------------------------It looks like something went wrongPlease read our Users guide for troubleshooting tips:/opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6/doc/Users guide.htmlIf that doesn't help, please use our support facilities at:http://www.modrails.com/We'll do our best to help you.

/usr/bin/rake文件的27行前加上一句:

require 'rubygems'

重新运行passenger命令就可以正确安装上。

ubuntu-8.10中原来已经安装了ruby-1.8.7,与ruby-enterprise中的ruby版本不一样,需要在用户根目录下的.bashrc文件中调整一下PATH

 vi ~/.bashrcexport PATH=/opt/ruby-enterprise/bin:$PATH

另外系统中sudo没有gem命令,需要加个软链接,这样才能用sudo安装gem包:

 sudo ln -s /opt/ruby-enterprise/bin/gem /usr/bin/gem

不要用sudo apt-get install rubygems安装。

之后再生成二个文件:

 sudo vi /etc/apache2/conf.d/railsLoadModule passenger_module /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6/ext/apache2/mod_passenger.soPassengerRoot /opt/ruby-enterprise/lib/ruby/gems/1.8/gems/passenger-2.0.6PassengerRuby /opt/ruby-enterprise/bin/rubyRailsEnv developmentRailsDefaultUser test
 sudo vi /etc/apache2/sites-enabled/rails_app<VirtualHost *:80>    ServerName www.servername.com    DocumentRoot /path/to/rails/public</VirtualHost>

重启apache2之后访问www.servername.com.