Ruby on Rails

Ruby on Rails はデータベースに接続するWebアプリケーションの開発のための、オープンソースのウェブフレームワークです。プログラマに設定よりも約束事を好むようなコードを書かせるので、プログラマの継続的な生産性に最適化されています。

インストール

Ruby on Rails を実行するには、Ruby, Ruby Gems, Ruby on Rails, lighttpd, MySQL PHP5 などをインストールする必要があります。Ruby の基本パッケージをインストールするには、ターミナルプロンプトで以下のコマンドを入力してください:

sudo apt-get install ruby ri rdoc libmysql-ruby

Ruby Gems パッケージをインストールするには、以下の一連のコマンドを実行してください:

sudo wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
tar -xvzf rubygems-0.9.0.tgz
cd rubygems-0.9.0
sudo ruby setup.rb

To install some basic gems, please run the following commands:

sudo gem install actionmailer
sudo gem install activesupport
sudo gem install actionpack
sudo gem install actionwebservice

Ruby on Rails パッケージをインストールするには、以下のコマンドを実行してください:

sudo gem install rails --include-dependencies

libhttpd パッケージをインストールするには、以下のコマンドを実行してください:

sudo apt-get install lighttpd libfcgi-dev libfcgi-ruby1.8
[ティップ]

The lighttpd is an Web Server. You can install both apache2 package and lighttpd package on same machine, but you can only run one at a time since both of them use the port number 80.

MySQL パッケージをインストールするには、MySQL セクションを参照してください。

PHP5 パッケージをインストールするには、PHP5 - スクリプト言語項 セクションを参照してください。

設定

Modify /etc/lighttpd/lighttpd.conf configuration file to setup your domains.

You should also enable couple of lighttpd modules for using Ruby on Rails. You can run the following commands to enable those modules:

sudo /usr/sbin/lighty-enable-mod fastcgi
sudo /usr/sbin/lighty-enable-mod proxy

Let us now verify the modification we did in the /etc/lighttpd/lighttpd.conf configuration file. Run the following commands to stop and verify the modification:

sudo /etc/init.d/lighttpd stop
sudo lighttpd -f /etc/lighttpd/lighttpd.conf

If you see any errors, please make sure to address them. The error message you see in the output is the best source for getting more help.

Thats it! Now you have your Server ready for your Ruby on Rails applications.