Posts Tagged ‘ rails ’

Recover ubuntu box from hack, part 12: Setting up RVM again

RVM (in this case) refers to Ruby Version Manager, which is a tool that makes it easy to manage Ruby versions and gem sets. This tool was recommended to me a by a friend who knows much more about Ruby and Rails and he was helping me to learn a bit. So I decided to set it up again on my server.

As per the instructions on the website, there are a few prerequisites:

sudo aptitude install git-core curl

Now that I have these things installed, I can run the script from the RVM site:

bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

Now I have to add a line to my .bashrc file so that RVM works properly at each boot:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"  # This loads RVM into a shell session.

Now I need to get the distribution-specific dependencies etc.:

rvm notes

This tells me I need to do the following:

sudo aptitude install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev

Now I just need to install ruby 1.8.7 as it is a prerequisite for 1.9.2 (not sure why any more, but I read it somewhere) then install 1.9.2 and set it as default:

rvm install 1.8.7 rvm install 1.9.2 rvm default 1.9.2 ruby -v ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux]

Woo its all set up and working. Now I need to cd into my old development directory and see if I can start the rails server!

rails s

Didn’t work. Hmm. Oh I don’t have the rails gem installed. Of course!

gem install rails
rails s

Still no. Hmm. Ah bundler…

bundle install 
rails s

Yay! Hurray! Rails server running and I can resume development.