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.
- 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.
- 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.
- Login to your server with the command ssh firstname.lastname@example.org
- Run the following command to update your CentOS rpm -Uvh http://mirror.centos.org/centos/5/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
- Do the same with this command rpm -Uvh http://mirror.centos.org/centos/5/os/i386/CentOS/yum-3.2.8-9.el5.centos.1.noarch.rpm
- Use YUM to remove the current Ruby install so we can update to the latest version by running yum remove ruby
- Change to your opt directory cd /opt
- 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 ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz
- Now run the tar command to extract the archive we just downloaded tar -zxvf ruby-1.9.1-p243.tar.gz
- 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
- Now lets head to our ruby directory cd ruby
- Run the command to install ruby ./configure && make && make install
- Lets pop out of this directory now cd ../
- We should now grab the latest RubyGems version which is 1.3.1 as of 2-24-2009 wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
- Uncompress the archive tar -zxvf rubygems-1.3.5.tgz
- Goto the new directory cd rubygems-1.3.5
- Run the setup to install RubyGems ruby setup.rb
- Now that we have gems installed we can start installing things in a much more simple manner. Start with Rails. gem install rails
- Now we will install Passenger the great Apache RoR app that we will be using instead of mongrel. gem install passenger
- 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 yourdomain.com. You need to replace this with your actual domain.
- First things first backup your apache config file. cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.backup
- 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/mod_passenger.so
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.
- 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/yourdomain.com/conf/vhost.conf then press i to enter insert mode. Copy and paste the following text. ServerName yourdomain.com
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.
- Let create our rails directory nowso we can setup our app. cd /var/www/vhosts/yourdomain.com then mkdir rails the cd rails
- Now we can create our rails application by typing rails yourappname
- 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
- Almost done, let’s move our httpdocs directory before we create a link. mv /var/www/vhosts/yourdomain.com/httpdocs /var/www/vhosts/yourdomain.com/httpdocs.old
- Now we can create a link redirecting visitors to our rails app instead of httpdocs. ln -s /var/www/vhosts/yourdomain.com/rails/yourappname/public /var/www/vhosts/yourdomain.com/httpdocs
- 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
- Restart apache service httpd restart
- 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.