Install Rails 2 and Rails 3 with rvm on Debian 5 Lenny and above

March 26, 2011 | By Regaz | Filed in: Uncategorized.

Hi Guys,

this tutorial will show You how to install, manage and switch between “Rails 2” and “Rails 3” on Debian Lenny 5.0.8 and above…

The process should work “as is” on a fresh install and your user dispose of
the right permissions…

First, we need to install some prerequisite stuff and we will provide do that
by executing this command on Terminal window:

$ sudo apt-get install subversion git-core autoconf bison sqlite3 zlib1g-dev libyaml-dev curl

Once this has been done we will provide to begin the installation of our ruby version manager
rvm pasting and executing the code below on a Terminal window:

$ bash < <( curl )

After we should take a look to the post-installion tasks looking at the result of:

$ rvm notes

After rvm has been successfully installed we need to provide the amendment of our .bashrc. First, we need to look if there exist a line containing "return" and we need to substitute that one by:

if [[ -n "$PS1" ]] ; then

Next you scroll down until to the end of your .bashrc and you add this:


Finally, you provide to give the path to rvm installation adding to the .bashrc:

[[ -s "/home/[YOURUSERNAME]/.rvm/scripts/rvm" ]] && source "/home/[YOURUSERNAME]/.rvm/scripts/rvm"

(Substitute your username instead of [YOURUSERNAME]) Now "rvm" should ready to work but we need before to open a new tab or close our Terminal window and open a new one. We check everything is fine giving this command:

rvm -v

This should show your rvm's version. After rvm's installation we can begin the installation of ours Rubies on Rails.

  1. Installation of Rails2 This will begin by the installation of a supporting ruby version. So type now in terminal the following:

    $ rvm install 1.8.7

    After the task has been successfully done we select by rvm this ruby by:

    $ rvm use 1.8.7

    Now we can provide directly to Rail2's installation:

    $ rvm gem install -v=2.3.8 rails

    Check than your rails has been installed by:

    $ rails -v

    that should result in a href="rails 2.3.8" Is important now provide to reinstall the right rubygems version for our Rails2 by:

    $ wget
    $ tar zxvf rubygems-1.5.0.tgz
    $ cd rubygems-1.5.0
    $ ruby setup.rb

    Check the version of rubygems is correct:

    $ gem -v

    Finally, you should provide to check your Rails2's installation is working by:

    $ rails test

    that should result in producing the usual Rails2 application's scheme.

  2. Installation of Rails3
    $ rvm install 1.9.2-head
    $ rvm use --default 1.9.2-head
    $ ruby -v
    $ rvm gem install --pre rails
    $ rails -v
    $ rails new ./testrails3
  3. Do Not Forget to Take a Look..

    Debian, Virtualization, Virtual Machine

    Feel Better on Debian Linux

Now Rails2 and Rails3 should both working together on your Debian :)

Some Other Rails Tutorials are Contained in this other Site:
Climb the InfoWall

Debian, Linux, Virtualization

Sviluppo Siti Web


VMWare VMware, VMware Tools, VMware Tools

Climb the InfoWall

Good luck!

Tags: , , , , , , , ,