>An ubuntu install script


Wrote a simple little script this morning to install all the software packages I might need for ruby development (plus a few security tools).  Hopefully it will serve someone other than me 🙂
I know, I know…  You can’t generalize and install some set of packages without knowing what they are.  That’s not the linux way.  On a production server, I’ll always perform a manual setup and, when I can, I compile from source rather than use packages.  This particular script is suited for a dev machine.
Note that, in the very beginning, I set up a few version variables.  You should be able to just set these and then fire up the script.
Caution: I’m providing this script as I use it, on a non-production, fresh install of a linux desktop environment. You can do whatever you want with it; but if you’re dumb enough to run this on a production server without checking it out in detail first, and it breaks your prod environment, don’t come complaining to me — I’ll hurt you, man! 😉
And now for the code:

#This script assumes that you’re running ubuntu 10.4 32-bit. For the metasploit, ruby enterprise and flash packages, you’ll definitely need to change the packages downloaded!

if [ “$(whoami)” != ‘root’ ]; then
        echo “You have no permission to run $0 as non-root user.”
        exit 1;

#Set a few variables here:

echo ************************** Installing basic packages: **************************
apt-get install -y build-essential subversion vpnc network-manager-vpnc libreadline5-dev

echo ************************** Installing forensics packages: **************************
apt-get install -y ewf-tools sleuthkit registry-tools hfsutils squashfs-tools
echo ************************** Installing security packages: **************************
apt-get install -y snort flow-tools aircrack-ng ettercap-gtk python-scapy wireshark tcpreplay ghex openvas-server openvas-client nmap zenmap

echo ************************** Setting up metasploit **************************
wget http://www.metasploit.com/releases/framework-`echo $metasploit_version`.run
chmod +x framework-`echo $metasploit_version`.run
./framework-`echo $metasploit_version`.run

echo ************************** Installing software development packages: **************************
apt-get install -y ruby`echo $ruby_version` ruby`echo $ruby_version`-dev libopenssl-ruby rubygems mysql-server meld

echo ************************** Installing web server packages: **************************
apt-get install -y apache2 apache2-prefork-dev libapr1-dev libaprutil1-dev

echo ************************** Removing mysql-server autostart **************************
update-rc.d -f mysql remove

echo ************************** Removing apache autostart **************************
update-rc.d -f apache2 remove

echo ************************** Setting up ruby enterprise **************************
wget http://rubyforge.org/frs/download.php/71100/ruby-enterprise_`echo $ruby_enterprise_version`.deb
dpkg -i ruby-enterprise_`echo $ruby_enterprise_version`.deb

echo ************************** Setting up passenger **************************
/usr/local/lib/ruby/gems/`echo $gem_version`/gems/passenger-`echo $passenger_version`/bin/passenger-install-apache2-module

echo LoadModule passenger_module /usr/local/lib/ruby/gems/`echo $gem_version`/gems/passenger-`echo $passenger_version`/ext/apache2/mod_passenger.so > /etc/apache2/mods-available/passenger.load
echo <IfModule mod_mime_magic.c> > /etc/apache2/mods-available/passenger.conf
echo PassengerRoot /usr/local/lib/ruby/gems/`echo $gem_version`/gems/passenger-`echo $passenger_version` >> /etc/apache2/mods-available/passenger.conf
echo PassengerRuby `which ruby` >> /etc/apache2/mods-available/passenger.conf
echo </IfModule> >> /etc/apache2/mods-available/passenger.conf

echo ************************** Getting Flash Player **************************
wget http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_`echo $flash_version`.deb
dpkg -i install_flash_player_`echo $flash_version`.deb

echo ************************** cleanup **************************
rm examples.desktop install_flash_player_10_linux.deb framework-`echo $metasploit_version`.run ruby-`echo $ruby_enterprise_version`.deb

Here’s a sample apache config (taken straight from phusion’s installer…):
   <VirtualHost *:80>
      ServerName http://www.yourhost.com
      DocumentRoot /somewhere/public 
      <Directory /somewhere/public>
         AllowOverride all
         Options -MultiViews