Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save smahi/11328671 to your computer and use it in GitHub Desktop.
Save smahi/11328671 to your computer and use it in GitHub Desktop.
# Install rvm system-wide
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
# 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 1.9.3 --default
# install the passenger gem
gem install passenger
# Try installing the apache module and watch it fail (no apache, yet)
passenger-install-apache2-module
# 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/mod_passenger.so
END_CONF
# 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
END_CONF
# 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
</Directory>
</VirtualHost>
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment