Prepare a Ruby on Rails Web Server

We have done the installation of Redmine on Ubuntu 10.x but what if you want to install Redmine or any other Ruby on Rails based application you need to prepare your server to have Ruby and Rails installed. You also need Passenger which will allow you to run a Ruby on Rails application on Apache. The following instructions should work on Debian Lenny (5.0) and Ubuntu 9.x/10.x. Let me know how you get on.

Let’s start by installing Apache web server.

{code}sudo apt-get install apache2 apache2-dev{/code}

I am getting you to install Apache development headers as well as we will need them later on; while installing passenger. Now, let’s install Ruby.

{code}sudo aptitude install ruby-dev ruby ri rdoc irb{/code}

Once the above completes without any errors, you can check the Ruby version using the following command.

{code}ruby -v{/code}

Download the latest version of Ruby Gems. At the time of writing this article the latest Ruby Gems version is 1.4.1

{code}wget http://production.cf.rubygems.org/rubygems/rubygems-1.4.1.tgz {/code}

Untar and run the setup from inside the folder.

{code}tar xvfz rubygems-1.4.1.tgz

cd rubygems-1.4.1

ruby ./setup.rb{/code}

Once done you can create a link so that gem command works

{code}ln -s /usr/bin/gem1.8 /usr/bin/gem{/code}

The following will help you to check the version

{code}gem -v{/code}

Now let’s install Rails.The following command may take a min to start so don’t get worried. Also, it will install the latest version of Rails but the latest version of Redmine only supports version 2.3.5 of Rails so you should use the second command below.

{code}gem install rails

gem install rails -v=2.3.5{/code}

You will also need rack version 1.0.1 for Redmine.

{code}gem install rack -v=1.0.1{/code}

That completes the installation of Ruby on Rails but now you need the web server which could serve Ruby applications e.g. Redmine.

{code}gem install passenger

passenger-install-apache2-module{/code}

Now follow the instructions provided by the passenger installer and the module will be ready to use with Apache Web Server. Don’t forget to restart your web server to make the changes take effect.

Share on:

Share on facebook
Share on twitter
Share on linkedin

You may also like