#!/bin/bash # Inspired by http://blog.fiveruns.com/2008/9/24/rails-automation-at-slicehost yum install -y l gcc-c++ zlib-devel openssl-devel yum install -y mysql-server mysql-devel /etc/init.d/mysqld start yum install -y ruby rdoc ruby-devel RUBYGEMS="rubygems-1.3.1" wget http://rubyforge.org/frs/download.php/45905/$RUBYGEMS.tgz tar xzf $RUBYGEMS.tgz cd $RUBYGEMS ruby setup.rb cd .. # Install Ruby Enterprise Edition wget http://rubyforge.org/frs/download.php/41040/ruby-enterprise-1.8.6-20080810.tar.gz tar xvzf ruby-enterprise-1.8.6-20080810.tar.gz yes '' | ./ruby-enterprise-1.8.6-20080810/installer # Install mysql gem /opt/ruby-enterprise-1.8.6-20080810/bin/gem install mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql gem install mysql -- --with-mysql-include=/usr/include/mysql --with-mysql-lib=/usr/lib/mysql # Install Passenger /usr/bin/gem install -v=2.0.3 passenger --no-rdoc --no-ri yum install -y httpd-devel yes '' | passenger-install-apache2-module # Create sample Rails app /usr/bin/gem install rails --no-rdoc --no-ri cd /var/www rails -d mysql hello cd hello ./script/generate controller welcome hello echo "Hello World" > app/views/welcome/hello.html.erb rake db:create RAILS_ENV=production # Create the Apache2 Passenger configuration cat >> /etc/httpd/conf.d/passenger.conf <<-EOF LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3 PassengerRuby /opt/ruby-enterprise-1.8.6-20080810/bin/ruby EOF