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.
-
The software repositories for Ubuntu 10.04 consist of older software. It's possible to install newer software on an older version of Ubuntu (or derivative), but it's easier to just use a newer distro with a repository of newer software to begin with. Using an old version of Ruby on Rails isn't an acceptable option. This is why Ubuntu 11.04 (or derivative) is needed.
-
The Ubuntu-based editions of Linux Mint consist of Ubuntu under the hood but have a better user interface. Many people (including myself) don't like the recent changes in Ubuntu. I've tried both Ubuntu 11.04 and Xubuntu 11.04, and I didn't like working with them. Linux Mint, on the other hand, specializes in making Ubuntu more user-friendly and is doing a sterling job of satisfying users (including myself) by retaining the look and feel of earlier versions. This is why I consider Linux Mint 11 to be far better than Ubuntu 11.04.
-
The LXDE edition of Linux Mint 11 is lighter and faster than its GNOME counterpart but provides a similar look and feel. GNOME is one of the heavier and slower desktop environments, and its computing overhead grows with each new version. Additionally, the new GNOME 3 has many controversial changes that many users don't like. Thus, given questions over the future of GNOME, I recommend using a more lightweight and conservative alternative.
Procedure
-
Install Linux Mint 11 with LXDE in VirtualBox.
-
Use the Reload button in Synaptic or the "sudo apt-get update" command to update the software repository.
-
Use Synaptic or Apt-Get to install Git. (The package is git.)
-
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
-
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.)
-
Install Rails by entering the following commands:
sudo gem install rails
sudo gem install sqlite3
-
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.
-
To see what versions of Rails are installed (not just the default version that's active), enter the command "gem list --local rails".
-
To install a different version of Rails, enter the command "sudo gem install rails --version (version #)".
-
To uninstall a version of Rails, enter the command "sudo gem uninstall rails --version (version #)".