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:
Upgrading Ruby
The default ruby on a DV 3.5 is version 1.8.5. Go ahead and uninstall that with the following command:
Now install Ruby 1.9.1:
cd ruby-1.9.1-p129
./configure && make && make install
Now, install RubyGems:
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:
You should get something like this as output:
Installing Rails and Passenger
Now that you’re this far, installing Rails is easy.
That’s it for Rails. As for Passenger, you’re going to need a few more packages from yum for the installation to work:
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:
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:
Now restart Apache:
That’s it.
