初めてのRuby!!Passenger(mod_rails)をとりあえず入れてみて
- May 12th, 2008
- Posted in Develop
- Write comment
今まで、Rubyっていうものは聴いたことはあったけど、一度も触ったことがなかった。
なんとなく、Ruby on Railsには興味はあったし、どんなものかも知っていたけど、
実行環境を作るのが面倒くさそうだった。
が、なんかmod_railsというのが出たらしい。
結構簡単に、環境が作れるらしい。
ということで、早速インストールしてみることにした。
| 前提: 以下が既にインストール済みとする。 Apache2 Ruby 1.8以降? |
まず、どうやらRuby関係の何かを入れるためにgemsというのが必要らしい。
ということで、インストール。
aptであったので、さっくりとaptから。
| # apt-get install rubygems |
あとで、知ったことだがここでとりあえずgemsをアップデートしておいた
ほうがいいらしい。(たぶん)
(自分の場合は失敗して、再インストールすることになってしまった)
| # gem update –system |
でさっそく、Passenger(mod_rails)をインストールしようとしたら・・・。
| # gem install passenger Bulk updating Gem source index for: http://gems.rubyforge.org ERROR: While executing gem … (Gem::GemNotFoundException) Could not find passenger (> 0) in any repository |
なんか怒られてしまった。
どうやら、railsを先にいれないといけないらしい。
Railsってつまりは、Ruby on RailsをやるためのFrameworkかな?
ということで、さっくりとインストール。
これも、gemsから出きるらしい。
| # gem install -v=2.0.2 rails -y Bulk updating Gem source index for: http://gems.rubyforge.org Successfully installed rails-2.0.2 Successfully installed rake-0.8.1 Successfully installed activesupport-2.0.2 Successfully installed activerecord-2.0.2 Successfully installed actionpack-2.0.2 Successfully installed actionmailer-2.0.2 Successfully installed activeresource-2.0.2 Installing ri documentation for rake-0.8.1… Installing ri documentation for activesupport-2.0.2… Installing ri documentation for activerecord-2.0.2… Installing ri documentation for actionpack-2.0.2… Installing ri documentation for actionmailer-2.0.2… Installing ri documentation for activeresource-2.0.2… Installing RDoc documentation for rake-0.8.1… Installing RDoc documentation for activesupport-2.0.2… Installing RDoc documentation for activerecord-2.0.2… Installing RDoc documentation for actionpack-2.0.2… Installing RDoc documentation for actionmailer-2.0.2… Installing RDoc documentation for activeresource-2.0.2… |
気を取り直して、Passenger(mod_rails)のインストール。
これもやっぱり、先ほどと一緒でgemsから。
| # gem install passenger ………… complete Install required dependency fastthread? [Yn] y Select which gem to install for your platform (i386-linux) 1. fastthread 1.0.1 (mswin32) 2. fastthread 1.0.1 (ruby) 3. fastthread 1.0.1 (i386-mswin32) 4. Skip this gem 5. Cancel installation > 2 Building native extensions. This could take a while… Building native extensions. This could take a while… Successfully installed passenger-1.0.5 Successfully installed fastthread-1.0.1 Installing ri documentation for passenger-1.0.5… Installing ri documentation for fastthread-1.0.1… No definition for dummy_dump No definition for dummy_dump No definition for rb_queue_marshal_load No definition for rb_queue_marshal_dump No definition for dummy_dump No definition for dummy_dump No definition for rb_queue_marshal_load No definition for rb_queue_marshal_dump |
で仕上げに、以下をやらないといけないらしい。
| # passenger-install-apache2-module —- passenger-install-apache2-module Welcome to the Passenger Apache 2 module installer, v1.0.5. This installer will guide you through the entire installation process. It Here's what you can expect from the installation process: 1. The Apache 2 module will be installed for you. Don't worry if anything goes wrong. This installer will advise you on how to Press Enter to continue, or Ctrl-C to abort. * GNU C++ compiler… found at /usr/bin/g++ ——————————————– rm -r pkg ### In ext/boost/src: ### In test: ### In benchmark: ### In ext/boost/src: ### In ext/apache2: ### In ext/apache2: ### In ext/apache2: ### In ext/apache2: ### In ext/apache2: ### In ext/apache2: ### In ext/passenger: ### In ext/passenger: ——————————————– Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-1.0.5/ext/apache2/mod_passenger.so After you restart Apache, you are ready to deploy any number of Ruby on Rails Press ENTER to continue. ——————————————– Suppose you have a Ruby on Rails application in /somewhere. Add a virtual host <VirtualHost *:80> And that's it! You may also want to check the Users Guide for security and /var/lib/gems/1.8/gems/passenger-1.0.5/doc/Users guide.html Enjoy Passenger, a product of Phusion (www.phusion.nl) |
すばらしい。
エラーもなく案外あっさりとインストールできてしまった。
しかも、最後に、httpd.confの設定例まで表示された。
httpd.confの設定は後回しにして。
ついでに、RubyとMySQLを連携させるためのモジュールらしきものもいれておく。
(これが必要なのかは確認していない・・・)
| # apt-get install MySQL-ruby |
これできっと完璧。
ということで、httpd.confの編集。
| # vim /etc/apache2/conf/httpd.conf (以下を追加) LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-1.0.5/ext/apache2/mod_passenger.so RailsSpawnServer /var/lib/gems/1.8/gems/passenger-1.0.5/bin/passenger-spawn-server RailsRuby /usr/bin/ruby |
ということで、Apacheを再起動。
| # service apache2 restart |
ということで、一通りインストールは完了した。
Popularity: 5% [?]
No comments yet.