-
-
Save lodestone/81845 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
<IfModule passenger_module> | |
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3 | |
PassengerRuby /opt/ruby-enterprise-1.8.6-20080810/bin/ruby | |
</IfModule> | |
EOF | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Inspired by http://blog.fiveruns.com/2008/9/24/rails-automation-at-slicehost | |
apt-get update | |
apt-get upgrade -y | |
apt-get -y install build-essential libssl-dev libreadline5-dev zlib1g-dev | |
apt-get -y install mysql-server libmysqlclient15-dev mysql-client | |
apt-get -y install ruby ruby1.8-dev irb ri rdoc libopenssl-ruby1.8 | |
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 Passenger | |
/usr/bin/gem1.8 install -v=2.0.3 passenger --no-rdoc --no-ri | |
apt-get -y install apache2-mpm-prefork apache2-prefork-dev | |
yes '' | passenger-install-apache2-module | |
# Create sample Rails app | |
/usr/bin/gem1.8 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 module files | |
cat >> /etc/apache2/mods-available/passenger.load <<-EOF | |
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3/ext/apache2/mod_passenger.so | |
EOF | |
cat >> /etc/apache2/mods-available/passenger.conf <<-EOF | |
<IfModule passenger_module> | |
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.0.3 | |
PassengerRuby /opt/ruby-enterprise-1.8.6-20080810/bin/ruby | |
</IfModule> | |
EOF | |
a2enmod passenger | |
# Create a site file for the sample Rails app | |
IP_ADDRESS=`ifconfig eth0 | sed -n 's/.*dr:\(.*\) Bc.*/\1/p'` | |
cat >> /etc/apache2/sites-available/hello <<-EOF | |
<VirtualHost $IP_ADDRESS:80> | |
ServerName www.yourhost.com | |
DocumentRoot /var/www/hello/public | |
</VirtualHost> | |
EOF | |
a2ensite hello | |
# That's it! | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment