Navigation

Entries in ubuntu (1)

Monday
Jun062011

Ubuntu RVM Rails pre install

I have a weird issue where I wipe and re-install operating systems all the time. Because of this, I decided to create a shell script that will install all the prerequisites for rvm, install and configure rvm and then install rails. Currently, it is set to install rails --pre (currently Rails 3.1.rc1).

#!/bin/bash

echo "Installing dependencies"

sudo apt-get install ruby curl bison build-essential autoconf zlib1g-dev libssl-dev libxml2-dev libreadline6-dev git-core subversion sqlite3

echo "Installing RVM"
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

echo "Configuring RVM"
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc
source ~/.bashrc

echo "Installing ruby 1.9.2-head"
rvm install 1.9.2-head

echo "Setting ruby 1.9.2-head as default"
rvm use 1.9.2-head --default

echo "Installing rails pre"
gem install rails --pre --no-ri --no-rdoc

Just run

source ubuntu_rvm_rails.sh

It will ask you for your sudo password and to confirm the installed dependencies.