Skip to content

Instantly share code, notes, and snippets.

@FooBarWidget
Last active December 30, 2015 09:58
Show Gist options
  • Save FooBarWidget/7812424 to your computer and use it in GitHub Desktop.
Save FooBarWidget/7812424 to your computer and use it in GitHub Desktop.
#!/bin/env bash
# wget -O install.sh https://gist.github.com/FooBarWidget/7812424.txt && sudo bash install.sh
# https://code.google.com/p/phusion-passenger/issues/detail?id=902
set -ex
export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/opt/aws/bin:/home/ec2-user/bin
# Install development environment
yum --assumeyes groupinstall 'Development Tools'
# install ruby depencies
yum --assumeyes install readline-devel openssl-devel libyaml-devel
# download and compile ruby 2.0.0
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p195.tar.gz && tar xvzf ruby-2.0.0-p195.tar.gz
cd ruby-2.0.0-p195 && ./configure --prefix='/usr/local' --disable-install-doc && make all && make install
# /usr/local/lib not in default load path
echo '/usr/local/lib' > /etc/ld.so.conf.d/usr_local.conf && ldconfig
# download and install rubygems into /usr/local
cd ../
wget http://production.cf.rubygems.org/rubygems/rubygems-2.0.3.tgz && tar xvzf rubygems-2.0.3.tgz
cd rubygems-2.0.3 && /usr/bin/env LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 /usr/local/bin/ruby ./setup.rb --no-rdoc --no-ri
# install passenger 4.0.5
yum --assumeyes install httpd httpd-devel libcurl-devel
/usr/local/bin/gem install passenger --version=4.0.5 --no-ri --no-rdoc
passenger-install-apache2-module -a
cat >> /etc/httpd/conf/httpd.conf << EOL
LoadModule passenger_module /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.5/libout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/2.0.0/gems/passenger-4.0.5
PassengerDefaultRuby /usr/local/bin/ruby
EOL
service httpd start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment