Skip to content

Instantly share code, notes, and snippets.

@gyulalaszlo
Created August 10, 2011 02:58
Show Gist options
  • Save gyulalaszlo/1135979 to your computer and use it in GitHub Desktop.
Save gyulalaszlo/1135979 to your computer and use it in GitHub Desktop.
Debian from blank install to RVM + Ruby 1.9.2 + MongoDB 1.8.2 + NGINX + Passenger + Node + Coffee
#!/usr/bin/env bash
echo '=========================== '
echo 'This script will attempt to install on a blank Debian Lenny / Squeeze: '
echo ' '
echo 'RVM with Ruby 1.9.2 '
echo 'NodeJS v0.4.10 with NPM and Coffee-Script '
echo 'MongoDb for the DB '
echo 'Imagemagick for the MiniMagick gem '
echo 'Passanger with nginx '
echo ' '
echo '=========================== '
echo " =====> Installing prerequisites..."
echo " --> Updating Debian keys if necessary"
sudo aptitude install debian-archive-keyring
echo " --> Adding 10gen mongodb repo to apt..."
# Add the apt key
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
# Add 10gen repo to apt
echo -e "\n\n# 10gen mongodb" | sudo tee -a /etc/apt/sources.list
echo "deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen" | sudo tee -a /etc/apt/sources.list
# update
sudo apt-get update
echo " --> Installing dev toolchain"
sudo apt-get install curl git git-core bzip2 gcc python make build-essential libcurl4-openssl-dev libssl-dev zlib1g-dev -y libxml2 libxml2-dev libxslt1.1 libxslt1-dev locales
echo " =====> Installing Mongo..."
echo " --> Getting Mongo..."
sudo apt-get install mongodb-10gen
echo " =====> Installing Ruby..."
echo " --> Installing RVM as root..."
sudo bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
sudo /usr/local/rvm/bin/rvm pkg install openssl
sudo /usr/local/rvm/bin/rvm pkg install zlib
sudo /usr/local/rvm/bin/rvm pkg install iconv
sudo /usr/local/rvm/bin/rvm install 1.9.2 --with-zlib-dir=$rvm_path/usr --with-openssl-dir=$rvm_path/usr --with-iconv-dir=$rvm_path/usr --with-xml2-dir=/usr --with-xslt-dir=/usr
sudo /usr/local/rvm/bin/rvm use 1.9.2 --default
echo " --> Installing Bundler to default Ruby..."
sudo /usr/local/rvm/bin/rvm gem install bundler
echo " --> Installing Passanger..."
sudo /usr/local/rvm/bin/rvm exec gem install passenger
sudo /usr/local/rvm/bin/rvm exec passenger-install-nginx-module
echo " --> Setting up Passenger init scripts..."
wget -O init-deb.sh http://library.linode.com/assets/600-init-deb.sh
sudo mv init-deb.sh /etc/init.d/nginx
sudo chown root:root /etc/init.d/nginx
sudo chmod +x /etc/init.d/nginx
sudo /usr/sbin/update-rc.d -f nginx defaults
echo " =====> Installing Node..."
echo " --> Installing Node..."
mkdir -p $HOME/vendor
cd $HOME/vendor/
git clone --depth 1 git://github.com/joyent/node.git # or git clone git://github.com/joyent/node.git if you want to checkout a stable tag
cd node
git checkout v0.6.1 # optional. Note that master is unstable.
./configure
make
sudo make install
echo " --> Installing NPM for Node..."
cd $HOME/vendor/
curl http://npmjs.org/install.sh | sudo clean=yes sh
echo " --> Installing Coffee-Script for Node..."
cd $HOME/vendor/
git clone git://github.com/jashkenas/coffee-script.git
cd coffee-script
sudo bin/cake install
echo " =====> Installing extras..."
echo " --> Installing Imagemagick..."
sudo apt-get install imagemagick -y
echo " --> Adding git group..."
sudo addgroup git
echo " --> Creating passenger user with disabled password auth"
sudo adduser --disabled-password --ingroup git passenger
echo "Setting up passenger directories"
sudo mkdir -p /u/apps; sudo chown passenger:passenger /u/apps
echo "Setting up SSH key locations"
sudo mkdir /home/passenger/.ssh; sudo chown passenger:passenger /home/passenger/.ssh
echo " =========== TO DO NEXT: ============= "
echo " --> set locales to UTF-8: sudo dpkg-reconfigure locales"
echo " --> Don't forget to copy your ssh keys to the 'passenger' user's .ssh folder"
@gyulalaszlo
Copy link
Author

Updated Node.js tag to 0.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment