3/17/2013 - 6:53 PM


# Install rvm system-wide
bash -s stable < <(curl -s )

# Update the packages
apt-get update
apt-get upgrade
apt-get install build-essential

# get the packages required by ruby
rvm pkg install zlib
rvm pkg install openssl

# install the latest ruby (and make it the default)
rvm install 1.9.3
rvm use 1.9.3 --default

# install the passenger gem
gem install passenger

# Try installing the apache module and watch it fail (no apache, yet)

# Install the following required packages (as per passenger's instructions)
apt-get install libcurl4-openssl-dev libssl-dev zlib1g-dev apache2-mpm-prefork apache2-prefork-dev libapr1-dev libaprutil1-dev

# Create /etc/apache2/mods-available/passenger.load and include:
cat >> /etc/apache2/mods-available/passenger.load <<END_CONF
   LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11/ext/apache2/

# Then create /etc/apache2/mods-available/passenger.conf
cat >> /etc/apache2/mods-available/passenger.conf <<END_CONF
   PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p0/gems/passenger-3.0.11
   PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p0/ruby

# Symlink passenger.conf and passenger.load to /etc/apache2/mods-enabled/
cd /etc/apache2/mods-enabled
ln -s ../mods-available/passenger.conf .
ln -s ../mods-available/passenger.load .

# Update your app's apache config in /etc/apache2/sites-available/appname with something similar to the following:

	<VirtualHost *:80>
		ServerAdmin webmaster@localhost
		DocumentRoot /home/user/appname/public
		<Directory /home/user/appname/public>
			AllowOverride all 
         		Options -MultiViews

# Then symlink this file from /etc/apache2/sites-enabled and reload apache:
cd /etc/apache2/sites-enabled
ln -s ../sites-available/appname .
/etc/init.d/apache2 reload