テクメモ このページをアンテナに追加 RSSフィード Twitter

2009-07-05

UbuntuにRuby、Rails、Passengerをインストール

ruby

$ sudo apt-get install ruby ruby-dev irb libopenssl-ruby

gem

$ sudo apt-get install rubygems
$ vi ~/.bashrc

# gemにパスを通す
export PATH="$PATH":/var/lib/gems/1.8/bin

$ source ~/.bashrc

rails

$ sudo gem install rails

passenger

$ sudo gem install passenger
$ sudo /var/lib/gems/1.8/bin/passenger-install-apache2-module

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 /var/lib/gems/1.9.0/bin/rake
 * Apache 2... found at /usr/sbin/apache2
 * Apache 2 development headers... not found
 * Apache Portable Runtime (APR) development headers... not found
 * Apache Portable Runtime Utility (APU) development headers... not found
# 足りないパッケージをインストール
$ sudo apt-get install apache2-prefork-dev libapr1-dev libaprutil1-dev 
# もう一度
$ sudo /var/lib/gems/1.8/bin/passenger-install-apache2-module

# 以下のような設定方法のメッセージが表示される
Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so
   PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.4
   PassengerRuby /usr/bin/ruby1.8
...
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    # <-- be sure to point to 'public'!
   </VirtualHost>

passengerとapacheの設定

$ cd /etc/apache2/mods-available
$ sudo vi rails.load

# インストール時に指定されたとおりに書く
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so
$ sudo vi rails.conf

PassengerRoot /var/lib/gems/1.8/gems/passenger-2.2.4
PassengerRuby /usr/bin/ruby1.8
$ sudo vi /etc/apache2/sites-available/yoursite

<VirtualHost *:80>
   ServerName www.yourhost.com
   DocumentRoot /somewhere/public
...
# モジュールとサイトを有効にする
$ sudo a2enmod rails
$ sudo a2ensite yoursite
$ sudo /etc/init.d/apache2 restart

スパム対策のためのダミーです。もし見えても何も入力しないでください
ゲスト


画像認証

トラックバック - http://d.hatena.ne.jp/lagos_on/20090705/1246751141
リンク元