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.

Instalação

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

Para instalar o pacote Ruby Gems, execute o seguinte conjunto de comandos:

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

Para instalar alguns gems básicos, por favor execute os comandos seguintes:

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

Para instalar o pacote Ruby on Rails, execute o seguinte comando:

sudo gem install rails --include-dependencies

Para instalar o lighttpd execute o seguinte comando:

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

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 “MySQL”.

Para instalar o pacote PHP5, consulte a seção “PHP5 - Linguagem de Scripts”.

Configuração

Modifique o arquivo de configuração /etc/lighttpd/lighttpd.conf para configurar seus domínios.

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.