Follow

Install Ruby on CentOS 7 with Passenger

  • Applies to: DV
    • Difficulty: Medium
    • Time Needed: 30
    • Tools Required: SSH access
  • Applies to: DV 4.0
    • Difficulty: Medium
    • Time Needed: 15
    • Tools Required: SSH access
  • Applies to: DV Developer
    • Difficulty: Medium
    • Time Needed: 30
    • Tools Required: SSH access

 

Overview

This guide will show you how to configure a Media Temple VPS (DV) or dedicated server to deliver Ruby applications with Phusion Passenger. Passenger is an open source web application server for Ruby. This is a from-scratch installation guide that will take you through the complete setup process. Please keep in mind that this article is provided as a courtesy. Third party applications are outside of the Media Temple scope of support. Media Temple is not responsible for the performance of Passenger and these instructions could change at any time. Please read our statement of support

Instructions

To take advantage of this guide, you will need to be able to SSH to your server with root privileges. You'll also need basic familiarity with BASH editors like vim or nano. These instructions are specific to (mt) Media Temple VPS customers that are using CentOS 7. Always start new installations by making sure that all of your packages are up to date. SSH to your server and execute the following:

yum -y update

1. Install RVM

Once your update completes, install Ruby Version Manager. RVM is a popular open source package manager. You may already be using a different package manager such as Rbenv, which should work fine. 

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 
\curl -sSL https://get.rvm.io | bash -s stable --ruby
usermod -a -G rvm `whoami`

2. Install Ruby

Install Ruby once the RVM installation completes. You can use any version that you need, but you may need to target a specific version depending on whether you already have an application built and ready to deploy. 

  • For the latest version:
rvm install ruby
rvm --default use ruby
  • For a specific version, replace the 'V's with your desired version number:
rvm install ruby-V.V.V
rvm --default use ruby-V.V.V

3. Install Bundler

Bundler is an easy to use Ruby application dependency manager. Without Bundler or an equivalent tool, you will have to install each application dependency manually. 

gem install bundler --no-rdoc --no-ri

4. Install node.js

node.js is required by Ruby on Rails for its JavaScript runtime environment. Install node.js if you plan on using Ruby on Rails. 

yum install -y epel-release
yum install -y --enablerepo=epel nodejs npm

5. Install Passenger with Nginx

It's a relatively straightforward process, but if you become stuck, Phusion has great tutorials on their site that can help you troubleshoot. The following commands will add Phusion's Yum repository and then download and install the required packages. Passenger uses a modified version of the Nginx web server. If you're already using a different web server such as Apache, or already have Nginx installed, this installation will still work. 

yum install -y epel-release pygpgme curl
curl --fail -sSLo /etc/yum.repos.d/passenger.repo https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
yum install -y nginx passenger
  • Use an editor such as Vim or Nano to edit passenger.conf. 
vim /etc/nginx/conf.d/passenger.conf

Find the following lines and remove the '#'. Passenger's documentation indicates that it's possible that these lines may not be there. If this is the case, cut and paste the uncommented lines below (remove the #) into passenger.conf. 

# passenger_root /some-filename/locations.ini;
# passenger_ruby /usr/bin/ruby;
# passenger_instance_registry_dir /var/run/passenger-instreg;

 

  • Save and quit. 
  • Restart the Nginx web server. 
service nginx restart
  • Test your installation by running the following:
/usr/bin/passenger-config validate-install 

You should receive a printout validating the installation. If you don't, use the instructions and whatever error messages appear to troubleshoot the issue. You may also consult Phusion's documenatation

* Checking whether this Phusion Passenger install is in PATH... ✓
* Checking whether there are no other Phusion Passenger installations... ✓
  • Update and reboot
yum -y update
yum reboot

Your server is now configured to deliver Ruby applications using a Passenger web application server. If you have any questions or concerns, please feel free to contact our award winning 24/7 support team. 

Resources

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk