Tuesday, May 15, 2012

How to install Rvm, Ruby, and Rails in Ubuntu 12.04

A concise guide to get Rails running locally.

1. Install package dependencies

sudo apt-get install zlib1g zlib1g-dev build-essential
sqlite3 libsqlite3-dev openssl libssl-dev curl git
libmagick++-dev libmagick++4

2. Install rvm from Github source

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

3. Reload terminal shell

source /home/ben/.rvm/scripts/rvm

4. Add rvm to bash

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

5. Add any additional requirements specified by rvm

rvm requirements
copy / paste any Additional Dependencies: specified in the terminal output into sudo apt-get

6. Install ruby version to rvm

rvm install 1.9.3-p194

*Update rvm and Ruby version (useful to know)
rvm get stable
rvm list known

Troubleshooting
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
Open your Terminal  and select Edit > Preferences > Run command as login shell (make sure it is selected)

7. Setup default ruby version in rvm

rvm use 1.9.3-p194 --default

8. Install rails

gem install rails

9. Install RSpec

gem install rspec

10. Install Bundler

gem install bundler

If you see ERROR: Gem bundler is not installed, run `gem install bundler` first. when running bundle change https://rubygems.org to http://rubygems.org in your Gemfile.

3 comments:

  1. Replies
    1. Thanks Muzi, really appreciate the feedback.

      Delete
  2. Ruby on Rails is fast growing in popularity and is powering applications of some of the fastest growing companies like Twitter and Groupon to name a few.

    ReplyDelete