Using Ruby On Rails With Apache2 On Debian Etch | HowtoForge - Linux Howtos and Tutorials

Using Ruby On Rails With Apache2 On Debian Etch

Version 1.0
Author: Falko Timme
Last edited 05/19/2007

This article shows how you can install Ruby on Rails (RoR) and integrate it in Apache2 on a Debian Etch system (including a short section at the end showing how to use RoR in a web site created with ISPConfig). Ruby on Rails is a web application framework which is rapidly gaining popularity among web programmers. It aims to increase the speed and ease with which database-driven web sites can be created and offers skeleton code frameworks (scaffolding) from the outset. Applications using the RoR framework are developed using the Model-View-Controller design pattern.
Remove ads

This document comes without warranty of any kind! I want to say that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!


1 Preliminary Note

I will use the hostname testapplication.example.com in this tutorial for the virtual host running Ruby on Rails.


2 Installing Ruby And Rails

In order to install Ruby and Ruby on Rails, we simply run

apt-get install ruby libzlib-ruby rdoc irb rubygems rails eruby


3 Installing Apache2 And mod-fcgid

Ruby on Rails can be integrated in Apache2 using mod-fcgid. Therefore we install the following packages:

apt-get install apache2 libapache2-mod-fcgid libfcgi-ruby1.8

Afterwards, we enable a few Apache modules:

a2enmod ssl
a2enmod rewrite
a2enmod suexec
a2enmod include

and reload Apache:

/etc/init.d/apache2 force-reload


4 Installing MySQL And The Ruby MySQL Bindings

Most probably you or your users will like to create database-driven Ruby on Rails applications, therefore we install the MySQL server and the Ruby MySQL bindings now:

apt-get install libmysql-ruby mysql-server

You should set a root password for MySQL now:

mysqladmin -u root password yourrootsqlpassword

If MySQL is listening not only on 127.0.0.1, but on other addresses as well (e.g. server1.example.com), you should set a root password for these addresses as well:

mysqladmin -h server1.example.com -u root password yourrootsqlpassword


5 Creating Our Ruby On Rails Environment

We can now create a directory in which we want to develop our future RoR applications. I'd like to develop them in /var/rails, so I create that directory now:

mkdir /var/rails

Apache2 should have read/write access to that directory, so we make the Apache user (www-data on Debian) and Apache group (again www-data) the owner and group of that directory:

chown -R www-data:www-data /var/rails

Now we can create our first RoR application which we will call testapplication. We will create testapplication under the user www-data so that Apache has read/write access to it:

cd /var/rails
su -m www-data

Now that we're logged in as www-data, we run

rails testapplication

This will create a directory called testapplication within /var/rails that contains all directories and files we need to develop our RoR application.

Next, we type in

exit

to become the root user again.

Using Ruby On Rails With Apache2 On Debian Etch | HowtoForge - Linux Howtos and Tutorials

Blogged with Flock

댓글

이 블로그의 인기 게시물

도꾜여행~! 여기는 꼭 가봐라

http://www.clearpointsystems.com/ewpi.php

How to use digital Signatures