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 os gems (plugins) básicos, por favor execute os seguintes comandos:

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 pacote 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.

Para instalar o pacote MySQL, por favor veja a secção MySQL.

Para instalar o pacote PHP5, por favor veja a secção “PHP5 - Scripting Language”.

Configuração

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

Deverá activar alguns módulos do lighttpd para usar o Ruby on Rails. Pode executar os seguintes comandos para activar esses módulos:

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.

Já está! Agora já tem o seu Servidor pronto para as suas aplicações Ruby on Rails.