Long story short

The following are steps we take at Hashrocket when setting up a near perfect Ruby development environment in GNU/Linux (Debian/Ubuntu). Feel free to copy and paste the commands into your terminal.

A Word of Caution

While it is unlikely any instruction given below might damage your system, it’s always a good idea to backup everything before doing any of it, just in case. I am not responsible for anything that may result from following the instructions below. Proceed at your own risk.

Prerequisite Debian/Ubuntu Apps:

Install vim

sudo apt-get install vim-gnome

Install utilities

sudo apt-get install curl bison build-essential zlib1g-dev libssl-dev libreadline5-dev libxml2-dev
sudo apt-get install wget ack exuberant-ctags markdown gitk openssh-server

get git

sudo apt-get install git-core

Install rvm

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

echo 'if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then source "$HOME/.rvm/scripts/rvm" ; fi' \
       >> ~/.bashrc.local

echo -e "export rvm_project_rvmrc_default=1
export rvm_install_on_use_flag=1
export rvm_project_rvmrc=1
export rvm_path='$HOME/.rvm'" > ~/.rvmrc

echo '[[ -r $rvm_path/scripts/completion ]] && source $rvm_path/scripts/completion' \
       >> ~/.bashrc.local # rvm autocompletion

Setup your global gems

A neat feature of rvm is defining the gems every rvm-controlled ruby will install on its global gemset. More here

Simply add your desired gems to the file: ~/.rvm/gemsets/global.gems like so:

rake -v0.9.2
hitch
dirty

Now each time you rvm install a ruby version, you’ll have hitch, dirty and rake version 0.9.2!

Create your .gemrc by copying & pasting the following in your terminal:

echo -e '---
:benchmark: false
gem: --no-ri --no-rdoc
:update_sources: true
:bulk_threshold: 1000
:verbose: true
:sources:
- http://rubygems.org
:backtrace: false' > ~/.gemrc

Install the rubies to your heart’s content

rvm install 1.8.7
rvm install 1.9.2
rvm use 1.9.2 --default

Install the Hashrocket dot files (don’t worry, you can override your preferences)

mkdir ~/hashrocket
cd ~/hashrocket
git clone http://github.com/hashrocket/dotmatrix.git
ln -s ~/hashrocket/dotmatrix/.bashrc ~/
ln -s ~/hashrocket/dotmatrix/.hashrc ~/
ln -s ~/hashrocket/dotmatrix/.vim ~/
ln -s ~/hashrocket/dotmatrix/.vimrc ~/
sh ~/hashrocket/dotmatrix/bin/vimbundles.sh

Mongo

Follow these instructions

Postgresql (more in-depth install here)

sudo apt-get install postgresql-common postgresql-server-dev-8.4 # Follow instructions

MySQL

sudo apt-get install mysql-common mysql-server-5.1 # Follow instructions

Generate a pubkey for that station

ssh-keygen -t rsa
# Add public key to your github account

Enjoy

update: [2011-08-23] rvm install process, other misc.