Setting up a Strato VServer for Rails


In this post I want to note what needs to be done to setup a Strato V-Server to serve a rails app with a new ruby version and the use of apache and passenger.

You should be root on the vserver!

Set up the system

Since the default installation contains ruby 1.8.7, we have to upgrade to a current version. For this I installed rvm to be able to switch and upgrade easily.

With rvm installed install the latest ruby version (or version needed to run your application).

×
bash
$ rvm install 1.9.3
$ 

or even better, but still with its own namespace

×
bash
$ rvm install 1.9.3 --patch railsexpress -n railsexpress
$ rvm use --default 1.9.3-railsexpress
$ rvm wrapper $(rvm current)
$ 

Now we need the passenger gem

×
bash
$ gem install passenger
$ 

Set up apache

First determine the current versions. We’ll need them later inside the configuration file

×
bash
$ rvm current
$ gem list | grep passenger
$ 

Install apache module

×
bash
$ $(rvm info homes|perl -ne 'm/ruby:\s*"(.*)"/ && print "$1\n"')/lib/ruby/gems/1.9.1/gems/passenger-$(gem list passenger|perl -ne 'm/\((.*)\)/ && print "$1\n"')/bin/passenger-install-apache2-module
$ 

It will print 3 lines to be added to some configuration. Place the line starting with

×
LoadModule

into /etc/apache2/mods-available/passenger.load, replacing any matching existing line.

Then place the lines starting with

×
Passenger*

into /etc/apache2/mods-available/passenger.conf, replacing any matching existing line.

Now enable passenger

×
bash
$ cd /etc/apache2/mods-enabled
$ ln -s ../mods-available/passenger.load
$ ln -s ../mods-available/passenger.conf
$ apache2ctl restart
$ 

And watch the error log

×
bash
$ tail -f /var/log/apache2/error.log
$ 

Updating ruby

×
bash
$ rvm get stable
$ rvm reinstall 1.9.3 --patch railsexpress -n railsexpress
$ 

Es gibt noch keine Kommentare