Skip to content

Instantly share code, notes, and snippets.

@henryhamon
Created November 26, 2009 12:43
Show Gist options
  • Save henryhamon/243432 to your computer and use it in GitHub Desktop.
Save henryhamon/243432 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Run these five command lines:
# sudo sed 's/\#deb\(.*universe\)/deb\1/' /etc/apt/sources.list -i.bak
# apt-get update
# sudo apt-get install wget
# sudo wget http://gist.github.com/243432.txt -O kalango_server_setup.sh
# sudo sh kalango_server_setup.sh
# Check for proper permission
if [ "$(whoami)" != "root" ] ; then
echo "Error: You must be root to run this command." >&2
exit 1
fi
echo "start"
alias aptinstall='apt-get -y install'
HOSTFILE="/etc/hostname"
echo "enable universe"
sed 's/\#deb\(.*universe\)/deb\1/' /etc/apt/sources.list -i.bak
apt-get update
echo "install basic stuff"
aptinstall man build-essential ssh wget vim git-core cron zlib1g zlib1g-dev
echo "We need to 'fix' openssl before we compile things that require openssl."
apt-get dist-upgrade
apt-get remove openssl
rm -rf /usr/bin/openssl
wget http://www.openssl.org/source/openssl-0.9.8k.tar.gz
tar xzf openssl-0.9.8k.tar.gz
cd openssl-0.9.8k
./config --prefix=/usr
sudo make
sudo make test
sudo make install
cd ..
echo "install apache"
aptinstall apache2 apache2-prefork-dev libapr1-dev libaprutil1-dev apache2-utils
echo "Your full hostname(example.yoursite.com):"
read yhostname
# Set up hostname
echo "$yhostname" >> ${HOSTFILE}
/etc/init.d/hostname.sh start
echo "Hostname configured"
echo "Choose the ruby version: [a]Ruby 1.8 [b]Ruby 1.9 [c]Both"
read rubyversion
if [ $rubyversion = "a" ];
then
echo "install ruby 1.8"
aptinstall ruby ri rdoc ruby1.8-dev irb1.8 libreadline-ruby1.8 \
libruby1.8 rdoc1.8 ri1.8 ruby1.8 irb libopenssl-ruby \
libopenssl-ruby1.8
ln -s /usr/bin/ruby1.8 /usr/bin/ruby
ln -s /usr/bin/rdoc1.8 /usr/bin/rdoc
ln -s /usr/bin/irb1.8 /usr/bin/irb
ln -s /usr/bin/ri1.8 /usr/bin/ri
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar xvzf rubygems-1.3.5.tgz
cd rubygems-1.3.5; ruby setup.rb
ln -fs /usr/bin/gem1.8 /usr/bin/gem
cd ..
rm rubygems-1.3.5.tgz
rm -rf rubygems-1.3.5
alias gemalias='gem'
alias rubyalias='ruby'
elif [ $rubyversion = "b" ];
then
echo "install ruby 1.9"
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz
tar xvzf ruby-1.9.1-p243.tar.gz
cd ruby-1.9.1-p243
autoconf
./configure --prefix=/usr/local --program-suffix=19 --with-readline-dir=/usr/local
sudo make
sudo make test
sudo make install
cd ..
alias gemalias='gem1.9'
alias rubyalias='ruby1.9'
else
then
echo "install ruby 1.8 and 1.9"
aptinstall ruby ri rdoc ruby1.8-dev irb1.8 libreadline-ruby1.8 \
libruby1.8 rdoc1.8 ri1.8 ruby1.8 irb libopenssl-ruby \
libopenssl-ruby1.8
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz
tar xvzf ruby-1.9.1-p243.tar.gz
cd ruby-1.9.1-p243
autoconf
./configure --prefix=/usr/local --program-suffix=19 --with-readline-dir=/usr/local
sudo make
sudo make test
sudo make install
cd ..
alias gemalias='gem1.8'
alias rubyalias='ruby1.8'
fi
echo "Do you want to install rails? (y/n)"
read installrails
if [ $installrails = "y"]
then
echo "install rails"
gemalias install rails --no-rdoc --no-ri
fi
echo "install passenger"
gemalias install passenger
# aptinstall passenger-install-apache2-module
# a2enmod rewrite
# echo "LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.4/ext/apache2/mod_passenger.so" >> $APACHECONF
# echo "PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.4" >> $APACHECONF
# echo "PassengerRuby /usr/local/bin/ruby1.8" >> $APACHECONF
#echo "setup of passenger apache module"
#passenger-install-apache2-module -a > /tmp/passenger-module-install.out
#if ! [ -e update_apache_conf_with_passenger_info.rb ]
#then
# wget http://gist.github.com/145917.txt -O update_apache_conf_with_passenger_info.rb
#fi
#rubyalias update_apache_conf_with_passenger_info.rb
echo "cleanup before we go..."
apt-get autoremove
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment