Ruby dalam 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.

Instalasi

Untuk menjalankan Ruby dalam Rails, anda harus menginstall Ruby, Ruby Gems, Ruby on Rails, lighttpd, MySQL and PHP5. Untuk menginstall paket dasar Ruby anda dapat memasukkan perintah dalam comman-line sebagai berikut:

sudo apt-get install ruby ri rdoc libmysql-ruby

Untuk menginstall paket Ruby Gems, ikuti perintah:

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

Untuk menginstall beberapa dasar gems, silakan jalankan perintah ini:

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

Untuk menginstall paket Rails dalam Ruby jalankan perintah sebagai berikut:

sudo gem install rails --include-dependencies

Untuk menginstall paket lighttpdjalankan peintah sebagai berikut:

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

lighttpd adalah Web Server. Anda dapat menginstall kedua paket apache2 dan paket lighttpd dalam satu mesin, tapi anda hanya dapat menggunakannya salah satu setelah keduanya di gunakan untuk mengakses port 80.

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

Untuk menginstall paket PHP5, silakan rujuk ke sesi “PHP5 - Scripting Language”

Konfigurasi

Pengubahan berkas konfigurasi /etc/lighttpd/lighttpd.conf untuk membangun domain anda

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.