Skip to content

Instantly share code, notes, and snippets.

@peelman
Last active November 9, 2015 14:26
Show Gist options
  • Save peelman/0ddb35cadddd58eb0a72 to your computer and use it in GitHub Desktop.
Save peelman/0ddb35cadddd58eb0a72 to your computer and use it in GitHub Desktop.
Ruby Setup on Ubuntu...

Ubuntu + Apache + Passenger + Ruby

  • Ubuntu 14.04.3
  • Apache 2.4
  • Passenger 5.x
  • Ruby 2.2.3

Install some Prereqs

apt-get install apache2 libcurl4-openssl-dev apache2-threaded-dev libapr1-dev libaprutil1-dev libncurses5-dev
apt-get install build-essential openssl libssl-dev libyaml-dev git-core libpq-dev zlib1g-dev libreadline6-dev

Install Ruby 2.2.3

wget ftp://ftp.ruby-lang.org//pub/ruby/2.2/ruby-2.2.3.zip
unzip ruby-2.2.3.zip 
rm ruby-2.2.3.zip 
cd ruby-2.2.3/
./configure --prefix=/usr/local
make
make install

Check Ruby Version

/usr/local/bin/ruby --version

Install Bundler and Passenger

/usr/local/bin/gem install bundle passenger

Run Passenger Installer & follow prompts to compile the apache module

/usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.X.XX/bin/passenger-install-apache2-module

Passenger Installer will tell you to create /etc/apache2/mods-available/passenger.load

It should look something like this:

LoadModule passenger_module /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.X.XX/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/lib/ruby/gems/2.2.0/gems/passenger-5.X.XX
  PassengerDefaultRuby /usr/local/bin/ruby
</IfModule>

Enable Apache Passenger Module Config as created in previous step

a2enmod passenger
service apache2 reload

Add a user for the app to run as

adduser --disabled-password --disabled-login --gecos "" username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment