Although I believe using RVM is a better way to install and manage Ruby on Ubuntu (see my article on how to do that), you can however just install Ruby from source code. Today I’ll go over the steps to do that as well as installing Rails 3.0.1 and SQLite.
I will be installing Ruby 1.9.2 on a clean Ubuntu 10.10 system. The first thing is to install all the required libraries:
$ sudo apt-get update
$ sudo apt-get install build-essential zlib1g zlib1g-dev libreadline5 libreadline5-dev libssl-dev
Grab the source code from the Ruby FTP site and adjust the version number as newer builds are released into the stable tree:
$ mkdir ruby-src && cd ruby-src
$ wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
$ tar -zxvf ruby-1.9.2-p0.tar.gz && cd ruby-1.9.2-p0
$ ./configure
$ make && sudo make install
Verify that the correct Ruby version is now running:
$ ruby -v
Since RubyGems already comes with Ruby 1.9.2 we can install Rails 3.0.1 (without the documentation) like this:
$ gem update --system
$ sudo gem install rails --no-rdoc --no-ri
Verify the correct Rails version was installed:
$ rails -v
Expected output:
Install SQLite and the SLQite ruby binding (without the documentation):
$ sudo apt-get install sqlite3 libsqlite3-dev
$ sudo gem install sqlite3-ruby --no-rdoc --no-ri
Verify the correct SQLite version was installed:
$ sqlite3 --version
Expected output:
List and verify your local Gems:
$ gem list --local
You are now ready to build Ruby on Rails 3 web apps.