Ruby on Rails

Ruby on Rails is an open source web framework for developing database backed web applications. It is optimized for sustainable productivity of the programmer since it lets the programmer to write code by favouring convention over configuration.

Installation

To run Ruby on Rails, you should install Ruby, Ruby Gems, Ruby on Rails, lighttpd, MySQL and PHP5. To install Ruby base packages you can enter the following command in the terminal prompt:

sudo apt-get install ruby ri rdoc libmysql-ruby

To install Ruby Gems package, run the following set of commands:

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

To install Ruby on Rails package run the following command:

sudo gem install rails --include-dependencies

To install lighttpd package run the following command:

sudo apt-get install lighttpd libfcgi-dev libfcgi-ruby1.8
[Tip]

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.

To install MySQL package, please refer to the the section called “MySQL”.

To install PHP5 package, please refer to the the section called “PHP5 - Scripting Language” section.

Configuration

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.