Upgrading Ruby and installing Rails 2.3 with Passenger on a MediaTemple DV 3.5

I have a MediaTemple DV 3.5 server and I am a Rails developer. These things don’t go together out of the box. There’s a little bit of work involved in getting the DV up to speed with Ruby and Rails, but it’s really not that hard. Here’s how I upgraded Ruby to 1.9.1, installed RubyGems, and got Passenger (mod_rails) going with Apache.

Getting the server ready

First, you have to make sure you have root access to your server and that the MediaTemple Developer Tools are installed.

Now that you’ve confirmed that you have root and the Developer Tools are installed, you have to make sure yum is installed on the server. The good part about getting these things set up is that you’ll never have to do them again!

I find it annoying to preface every command with “sudo”, so all the following commands assume that you’ve entered a root shell with:

sudo su -

Upgrading Ruby

The default ruby on a DV 3.5 is version 1.8.5. Go ahead and uninstall that with the following command:

sudo yum remove ruby

Now install Ruby 1.9.1:

wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p129.tar.gz
cd ruby-1.9.1-p129
./configure && make && make install

Now, install RubyGems:

cd ..
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
cd rubygems-1.3.5
ruby setup.rb

Check that you have the correct ruby installed by doing:

ruby -v

You should get something like this as output:

ruby 1.9.1p129 (2009-05-12 revision 23412) [i686-linux]

Installing Rails and Passenger

Now that you’re this far, installing Rails is easy.

sudo gem install rails

That’s it for Rails. As for Passenger, you’re going to need a few more packages from yum for the installation to work:

yum install httpd-devel
gem install passenger
passenger-install-apache2-module

Now, we have to tell Apache to load Passenger when it starts up. The Passenger script probably told you that you had to include something like this in the httpd.conf:

LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.4/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-2.2.4
PassengerRuby /usr/local/bin/ruby

Open up httpd.conf using nano and add these lines after the loooong list of other LoadModule directives:

nano /etc/htttpd/conf.d/httpd.conf

Now restart Apache:

service httpd restart

That’s it.

Post a Comment »

Name (required)

Email (will never be shared or displayed)

URL

Want me to remember your information?

Notify you of follow-up comments?

Comments

This is only here because I think it looks cool.

I'm Georges and I live in Toronto. I am a web developer and it's fun. This is a collection of things that I like and a place for me to record my thoughts on things.

Last Entry

Watch the Daily Show and the Colbert Report in Canada

Topics

Pointless Statistics

Total Entries: 6
Total Comments: 6
Most Recent Entry: 08/26/2009 05:58 pm
Most Recent Comment on: 12/26/2009 07:36 am
Most Recent Visitor on: 03/14/2010 08:27 pm
The most visitors ever was 36 on 08/23/2008 08:06 pm