Install Ruby on Rails 3 on Debian 6 (Squeeze) using RVM

First at all I decided to install Ruby & RoR using RVM because (yup, imma RoR n00b) seems to be a really common thing to switch between ruby versions,gems and anything while developing any kind of ror apps.

Also, because Debian version is (of course) outdated and besides that i ran into a lot of problems while i was trying to install it using the packages... Yeah, gotta love Debian . Errors like:

  1. File not found: lib.
  2. Execjs: Could not find a JavaScript runtime
  3. And so on...

First some packages that you probably already have if you are a developer:

apt-get install curl git-core

Now because RVM downloads and compiles a LOT of the stuff we are installing you'll need:

apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison

(Again, if you are a developer you might already have some of em installed)

And this one if you plan to use Mysql on your project:

apt-get install libmysqlclient-dev

Here, make sure you don't have any Ruby packages installed and begin installing RVM (and from now on don't run anything as root):

bash < <(curl -sk

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

Now if you are a Gnome user make sure to check this option on your Terminal profile perferences (don't ask me why, just do it™ ):


To continue restart your Terminal, then:

// Checks if rvm is installed correctly (it MUST return 'rvm is a function')

$> type rvm | head -1

// Install Ruby and make sure it works

$> rvm install 1.9.2

$> rvm use 1.9.2

$> ruby -v

// Create a new gemset and install Rails

$> rvm gemset create rails305

$> gem install rails -v 3.0.5

// SQlite database extension

$> gem install sqlite3

// MySQl database extension

$> gem install mysql2

At this point if everything went OK you are good to go, still I recommend ya to run a simple app to make sure:

rails new HelloWorld

cd HelloWorld

rails server

Related Posts
The comments are closed on this section.
Hire me!

I'm currently open for new projects or join pretty much any project i may fit in, let me know!

Read about what I do, or contact me for details.