Install Ruby on Rails with Passenger on MediaTemple DV 3.5 | How To

This article is outdated and only here for archival reasons. The article might still work but MT is on DV 4.0 now which I have not tested any of this on.


This article is from 2009. I am not sure if it is accurate anymore as I have moved on to different web technologies. Please leave a comment if something is off.

The following article is a summary of the 3 days I spent trying to get this to work. The installation is not the same installation explained by Passenger’s website and a ton of other websites. This article pertains to Ruby on Rails, Media Temple and Passenger for Apache a simple to use replacement for Mongrel.

First of all you have to have a fresh (or re-imaged) DV 3.5 account with MediaTemple otherwise this article does not apply to you.

  1. Go to your MediaTemple account center and click the domain you are using. You will then see a link labeled Root Access & Developer Tools. Go there and activate both.
  2. Open up you favorite ssh program to access to the great unix command line of your dedicated server. I use plain old terminal on Mac OSX.
  3. Login to your server with the command ssh
  4. Run the following command to update your CentOS rpm -Uvh
  5. Do the same with this command rpm -Uvh
  6. Use YUM to remove the current Ruby install so we can update to the latest version by running yum remove ruby
  7. Change to your opt directory cd /opt
  8. Get the current Ruby build, I am providing a link for 1.8.7 which is the current version as of 2-24-2009 wget
  9. Now run the tar command to extract the archive we just downloaded tar -zxvf ruby-1.9.1-p243.tar.gz
  10. Now we are going to create a link so you can access ruby without added the version numbers ln -s ruby-1.9.1-p243 ruby
  11. Now lets head to our ruby directory cd ruby
  12. Run the command to install ruby ./configure && make && make install
  13. Lets pop out of this directory now cd ../
  14. We should now grab the latest RubyGems version which is 1.3.1 as of 2-24-2009 wget
  15. Uncompress the archive tar -zxvf rubygems-1.3.5.tgz
  16. Goto the new directory cd rubygems-1.3.5
  17. Run the setup to install RubyGems ruby setup.rb
  18. Now that we have gems installed we can start installing things in a much more simple manner. Start with Rails. gem install rails
  19. Now we will install Passenger the great Apache RoR app that we will be using instead of mongrel. gem install passenger
  20. We need to run one additional command to get Passenger setup passenger-install-apache2-module

That was the basic installation process. Now we will move on to the account specific modifications that are required to get this to work with MediaTemple. Pay attention to the text don’t just copy and paste there will be lines you need to modify. Pay attention to anything that say You need to replace this with your actual domain.

  1. First things first backup your apache config file. cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.backup
  2. You may need to edit these paths depending on what the current version of passenger is. We will now use the unix built in vi editor to edit our config file. Do this by running vi /etc/httpd/conf/httpd.conf then we scroll down to the section that has all the LoadModules commands. Go to the last space and press i to enter insert mode. Add the following to your file.
    LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.1.3/ext/apache2/
    PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.1.3
    PassengerRuby /usr/local/bin/ruby

    now just press escape to exit insert mode. Type :w and press enter then type :q and enter. You should be back at the console prompt.
  3. Apache is now setup correctly. Next we will create a nifty little file that MT uses for VirtualHosts. This is where things get different since normally you would put this info in the apache config. Create a new file by typing the following vi /var/www/vhosts/ then press i to enter insert mode. Copy and paste the following text. ServerName
    DocumentRoot /var/www/vhosts/
    <Directory “/var/www/vhosts/”>
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
    RailsBaseURI /
    then press escape to exit insert mode. Then type :w and enter then :q and enter. Your back at the command line.
  4. Let create our rails directory nowso we can setup our app. cd /var/www/vhosts/ then mkdir rails the cd rails
  5. Now we can create our rails application by typing rails yourappname
  6. Your rails app will be created now we have to give your user account that you use on MT permission by typing chown -R yourusername:psaserv yourappname
  7. Almost done, let’s move our httpdocs directory before we create a link. mv /var/www/vhosts/ /var/www/vhosts/
  8. Now we can create a link redirecting visitors to our rails app instead of httpdocs. ln -s /var/www/vhosts/ /var/www/vhosts/
  9. Run this command to update the server to let it know about our VHost file we created earlier /usr/local/psa/admin/sbin/websrvmng -a
  10. Restart apache service httpd restart
  11. Your done! You can upload changed files to your website at that rails/yourappname directory. Hope that helps anyone stuck.

Thanks for reading hope it was helpful.


24 responses to this post.

  1. I ended up getting passenger 2.1.3 when I ran “gem install passenger” and so the lines needed for var/www/vhosts/ were:

    LoadModule passenger_module /usr/local/rubygems/gems/gems/passenger-2.1.3/ext/apache2/
    PassengerRoot /usr/local/rubygems/gems/gems/passenger-2.1.3
    PassengerRuby /usr/local/bin/ruby

  2. Hi Greg,

    First of all , thank you for this “how to” it was very useful and gave more confident on what I was doing.

    I am wondering if you previously crated the VHOST using plesk or not, but I could not find a user to use until I created a new domain via plesk.

    Just FYI, I did not installed regular ruby distribution but Ruby Enterprise Edition so my http.conf entries look like this due REE and Passenger installation recommendation:

    Ruby Enterprise Edition is successfully installed!
    If want to use Phusion Passenger ( in combination
    with Ruby Enterprise Edition, then you must reinstall Phusion Passenger against
    Ruby Enterprise Edition, as follows:


    Make sure you don’t forget to paste the Apache configuration directives that
    the installer gives you.

    If you ever want to uninstall Ruby Enterprise Edition, simply remove this


    If you have any questions, feel free to visit our website:

    Enjoy Ruby Enterprise Edition, a product of Phusion ( 🙂

    The Apache 2 module was successfully installed.

    Please edit your Apache configuration file, and add these lines:

    LoadModule passenger_module /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.2.0/ext/apache2/
    PassengerRoot /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/passenger-2.2.0
    PassengerRuby /opt/ruby-enterprise-1.8.6-20090201/bin/ruby

    After you restart Apache, you are ready to deploy any number of Ruby on Rails
    applications on Apache, without any further Ruby on Rails-specific

    Fidel Vanegas

  3. Posted by Greg on April 18, 2009 at 8:16 am

    Thanks for the great feedback guys. I am glad you were both able to get it working. I am going to be editing the post to make some changes based on your feedback.

  4. Hey Greg,

    Being a total noob at sys admin stuff, I just had to drop a comment and say thanks for this step by step tutorial 🙂

    BTW, anyone know why it’s recommended to write all vhost info in /conf/vhost.conf as opposed to /conf/httpd.include ?

  5. Posted by Greg2 on October 8, 2009 at 4:53 pm

    Thanks for this, I’ve been struggling for 2 days to get it to work — going to try with a clean install of my dv server and post back to you with my results.

    The line about ‘websrvmng -a’ is what has me excited that this might work, because this is the first time I’ve heard anything about that command. And my problems so far have been that the vhost file doesn’t seem to be doing anything.

  6. Posted by Greg2 on October 21, 2009 at 7:29 am

    It worked! Thanks again — media temple should have this as their default tutorial for setting up rails on the DV.

  7. Posted by Greg on October 23, 2009 at 12:33 am

    Thanks for all the great feedback I have updated the post based on your recommendations and version changes.

  8. Posted by MrCheetoDust on November 22, 2009 at 1:07 am

    Thanks a lot for taking the time to thoroughly document the process AND keep it up to date!

  9. I am deploying to a subdomain and have followed all the above instructions inserting the subdomain at the relevant places but cannot get get my app to fire up on the subdomain. The app is deployed properly because I can run it using script/server on port 3000. Any ideas where I could be going wrong with the subdomain?

  10. Just wanted to express my gratitude as well for putting together this how to and keeping it updated. I used your walk through a couple months ago when setting up passenger and then again yesterday when hooking in git and capistrano. Mediatemple should have your guide on their knowledgebase.

    Thanks again, Greg!

  11. Posted by Warren on March 8, 2010 at 1:53 am

    Thanks for the great Tutorial!!


    Were you able to resolve the issue you had concerning the subdomain setup, I am about to do this myself and would appreciate to know what you found out. warren.aikema(at)gmail(dot)com.



  12. Warren,

    I gave up and installed the app on a media temple grid and had the app up and running in about 10 mins, mch less hassle.

  13. I am trying to get this up and running on our MediaTemple dv, and while it works with the index.html file in the public folder, if I delete and restart the server, our app breaks and none of our routing works. Any suggestions?

  14. Greg, sir, I owe you a beer. Or perhaps a truckload of beer. And the truck itself. Thanks a million for this walkthrough; I’m fairly confident you saved me days of frustration, a laptop, and a window.

  15. Posted by Greg on July 30, 2010 at 8:29 am

    No problem glad it helped. I know how frustrating spending way too much time on something can be.

  16. Posted by suciu vlad on September 5, 2010 at 10:33 pm

    thanks for taking the time to write this.

  17. Posted by michael on September 16, 2010 at 2:34 am

    Worked beautifully…saved me tons of time. Thanks for writing this up.

  18. Posted by Chad on September 17, 2010 at 8:59 pm

    Thank you for the write up friend! Saved me some real grief.

  19. Great article! This gave me a lot more confidence and was a lot more concise than other articles. I have a quick question. When I reach the point where I’m installing passenger’s apache2 module:

    $ passenger-install-apache2-module

    I’m getting this error:

    Compiling and installing Apache 2 module…
    cd /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2
    /usr/local/bin/ruby /usr/local/bin/rake apache2:clean apache2 RELEASE=yes
    # /usr/local/bin/ruby /usr/local/bin/rake apache2:clean apache2 RELEASE=yes
    (in /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2)
    rake aborted!
    Permission denied – /tmp/passenger-compile-check-26024.c.out
    /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/platform_info.rb:224:in `spawn’
    /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/platform_info.rb:224:in `try_compile_and_run’
    /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/platform_info/operating_system.rb:132:in `supports_sfence_instruction?’
    /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/platform_info.rb:92:in `supports_sfence_instruction?’
    /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/platform_info/compiler.rb:141:in `portability_cflags’
    /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/lib/phusion_passenger/platform_info.rb:92:in `portability_cflags’
    /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/build/common_library.rb:156:in `define_libboost_oxt_task’
    /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/build/common_library.rb:268:in `’
    :29:in `require’
    :29:in `require’
    /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.2/Rakefile:26:in `’
    /usr/local/lib/ruby/1.9.1/rake.rb:2373:in `load’
    /usr/local/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile’
    /usr/local/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile’
    /usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling’
    /usr/local/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile’
    /usr/local/lib/ruby/1.9.1/rake.rb:1991:in `run’
    /usr/local/bin/rake:31:in `’


    I’m on:
    – Apache 2
    – ruby 1.9.2p0
    – Rails 3.0.3
    – Passenger-3.0.2

    Any ideas what is causing this or how I could fix it? I’d greatly appreciate any help. The only suggestion I could find anywhere was to remount /tmp with noexec off, and I have no idea what that is or how to do it.


  20. I figured out my issue. For Media Temple dv and ve servers you need to account for noexecs allowed on /tmp

    Here’s a write-up:

  21. David, were you able to get your app running? I have everything installed but can’t seem to get Passenger to recognize my gems. It’s weird because everything works when I run “passenger start” and go to :3000.

    Example error:
    Could not find activesupport-3.0.3 in any of the sources (Bundler::GemNotFound)

    Same setup as you:

    – Apache 2
    – ruby 1.9.2p0
    – Rails 3.0.3
    – Passenger-3.0.2

    Any help would be greatly appreciated. Been working on this for a few days now..


  22. I have the same problem as you Levi, can’t get the server to accept the location of the app. I ordered DV v4 just to start running RoR apps. If I can’t get it to work over the next couple of days I will probably leave (mt) for Heroku instead.

  23. Posted by Jess Brown on February 11, 2011 at 3:27 am

    Same problem.
    I ran into a problem compiling apache2 passenger module. It was trying to execute in the /tmp directory which is not executable. I found this in the media temple site:
    > mkdir ~/tmptmp
    > mount –bind ~/tmp /tmp

    run the module again
    > passenger-install-apache2-module

    It should install. now fix the /tmp directory
    > umount /tmp

  24. I have sorted it out as well. I had a problem installing the latest version of SQlite and some other gems.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: