Installing Ruby on Rails in Ubuntu or a Ubuntu-based Distro

NOTE: I now use Linux Mint Debian Edition for working on Ruby on Rails. But in the interest of sharing my knowledge and experience, I am leaving this page up. The procedures here worked for me and are based on the procedure in the book Agile Web Development with Rails

Why Use Linux Mint 11 with LXDE

The 4th edition of Agile Web Development with Rails recommends Ubuntu 10.04, but I think Linux Mint 11 with LXDE is better.

Procedure

  1. Install Linux Mint 11 with LXDE in VirtualBox.
  2. Use the Reload button in Synaptic or the "sudo apt-get update" command to update the software repository.
  3. Use Synaptic or Apt-Get to install Git. (The package is git.)
  4. To install Ruby and RubyGems, use Synaptic or Apt-Get to install the following packages: build-essential libfcgi-dev ruby rubygems ruby1.8-dev sqlite3 libsqlite3-dev libxslt1-dev
  5. In the command line, enter "ruby -v" to see what version of Ruby you have installed. (It should be 1.8.7.) Enter "gem -v" to see what version of RubyGems is installed. (It should be at least 1.3.7.)
  6. Install Rails by entering the following commands:
    sudo gem install rails
    sudo gem install sqlite3
  7. To see what version of rails you are using, enter the command "rails -v". If you get an error message, create the file .bashrc in your /home/(username) directory and insert the line "export PATH=/var/lib/gems/1.8/bin". The "rails -v" command should now work.
  8. To see what versions of Rails are installed (not just the default version that's active), enter the command "gem list --local rails".
  9. To install a different version of Rails, enter the command "sudo gem install rails --version (version #)".
  10. To uninstall a version of Rails, enter the command "sudo gem uninstall rails --version (version #)".