Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save beef/114059 to your computer and use it in GitHub Desktop.
Save beef/114059 to your computer and use it in GitHub Desktop.
Unattended Rails (Passenger, Ruby Enterprise) Stack
#!/bin/bash
# Unattended REE/Passenger installation
# Source: http://weblog.brightlight-ict.nl/2008/12/unattended-passenger-ruby-enterprise-installation-on-ubuntu-8/
# 15/03/09 Updated to use latest r.e.e. and passenger 2.1 and rewrote bits thanks to the comments left on my blog. Thanks guys
# 05/10/09 Update to use latest r.e.e. and passenger 2.2.5 (beef)
# 27/10/09 Update to use latest r.e.e. (beef)
# 23/11/09 Update to use latest passenger 2.2.7 (beef)
# 23/12/09 Using deb package rather the source
# 11/03/10 added new version of enterprise .deb
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi
VERSION="1.2"
REEV="http://rubyforge.org/frs/download.php/68720/ruby-enterprise_1.8.7-2010.01_amd64.deb"
REEF="ruby-enterprise_1.8.7-2010.01_amd64.deb"
echo "#####################################"
echo "Welcome, let's get this party rollin'"
echo "#####################################"
echo "Updating Aptitude"
apt-get update
echo "Installing build essentials"
apt-get install build-essential zlib1g-dev libssl-dev wget libreadline5-dev libsqlite3-dev -y
echo "Installing GIT"
apt-get install -y git-core
echo "Installing apache"
apt-get install -y apache2
echo "Installing apache headers"
apt-get install -y apache2-prefork-dev
echo "Installing Ruby Enterprise from following url"
echo $REEV
wget $REEV
if [ -e $REEF ]
then
echo "File downloaded succesful"
else
echo "Error, file wasn't downloaded!"
exit
fi
dpkg -i $REEF
gem update --system
gem update
echo "Config passenger"
passenger-install-apache2-module
echo "Copying passenger files"
touch /etc/apache2/mods-available/passenger.load
touch /etc/apache2/mods-available/passenger.conf
echo "LoadModule passenger_module /opt/ruby/lib/ruby/gems/1.8/gems/passenger-$PASSENGER/ext/apache2/mod_passenger.so" >> /etc/apache2/mods-available/passenger.load
echo "PassengerRoot /opt/ruby/lib/ruby/gems/1.8/gems/passenger-$PASSENGER
PassengerRuby /opt/ruby/bin/ruby" >> /etc/apache2/mods-available/passenger.conf
echo "Enabling passenger module"
a2enmod passenger
echo "Reloading apache"
/etc/init.d/apache2 reload
echo "##########################"
echo "# Installation Complete"
echo "##########################"
sleep 2
echo "##########################"
echo "# Installed Ruby Version #"
echo "##########################"
ruby -v
echo "##########################"
echo "# Installed Gems Version #"
echo "##########################"
gem -v
passenger-status
#!/bin/bash
# Unattended REE/Passenger installation
# Source: http://weblog.brightlight-ict.nl/2008/12/unattended-passenger-ruby-enterprise-installation-on-ubuntu-8/
# 15/03/09 Updated to use latest r.e.e. and passenger 2.1 and rewrote bits thanks to the comments left on my blog. Thanks guys
# 05/10/09 Update to use latest r.e.e. and passenger 2.2.5 (beef)
# 27/10/09 Update to use latest r.e.e. (beef)
# 23/11/09 Update to use latest passenger 2.2.7 (beef)
# 23/12/09 Using deb package rather the source and using improved nginx init.d from http://antoniocangiano.com/2009/11/20/setup-ruby-enterprise-edition-nginx-and-passenger-aka-mod_rails-on-ubuntu/
# 11/03/10 added new version of enterprise .deb
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi
VERSION="1.2"
REEV="http://rubyforge.org/frs/download.php/68720/ruby-enterprise_1.8.7-2010.01_amd64.deb"
REEF="ruby-enterprise_1.8.7-2010.01_amd64.deb"
echo "#####################################"
echo "Welcome, let's get this party rollin'"
echo "#####################################"
echo "Updating Aptitude"
apt-get update
echo "Installing build essentials"
apt-get install build-essential zlib1g-dev libssl-dev wget libreadline5-dev libsqlite3-dev -y
echo "Installing GIT"
apt-get install -y git-core
echo "Installing Ruby Enterprise from following url"
echo $REEV
wget $REEV
if [ -e $REEF ]
then
echo "File downloaded succesful"
else
echo "Error, file wasn't downloaded!"
exit
fi
dpkg -i $REEF
gem update --system
gem update
echo "Config passenger"
passenger-install-nginx-module
echo "Create nginx init script"
wget http://gist.github.com/252552.txt
mv 252552.txt /etc/init.d/nginx
chown root:root /etc/init.d/nginx
chmod +x /etc/init.d/nginx
echo "Start nginx"
/etc/init.d/nginx start
echo "Config start nginx on boot"
/usr/sbin/update-rc.d -f nginx defaults
echo "##########################"
echo "# Installation Complete"
echo "##########################"
sleep 2
echo "##########################"
echo "# Installed Ruby Version #"
echo "##########################"
ruby -v
echo "##########################"
echo "# Installed Gems Version #"
echo "##########################"
gem -v
passenger-status
echo "##########################"
echo "# nginx status #"
echo "##########################"
/etc/init.d/nginx status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment