Howto install Rails 2.3, Ruby 1.9.1, MySQL 5.1 on Ubuntu Lucid 10.04

Well, I am abit ahead of the release date. This tutorial is done on Ubuntu Lucid 10.04 beta and I would not expect there would be major changes in final release that could disrupt any instructions listed here.

Ubuntu repository contains Ruby 1.9.1 package however this package suffers few bugs that doesn’t run some Gem packages. So I would highly RECOMMEND you to compile for yourself a instance of Ruby 1.9.1 from source. To compile Ruby from source, you need to install compilers and libraries headers.

$ sudo apt-get -y install libc6-dev libssl-dev libmysql++-dev libsqlite3-dev make build-essential libssl-dev libreadline5-dev zlib1g-dev

Install Ruby 1.9.1 from source

$ cd /tmp
$ mkdir src
$ cd src
$ wget
$ tar xjvf ruby-1.9.1-p378.tar.bz2
$ cd ruby-19.1-p378
$ ./configure --prefix=/usr/local
$ sudo make && sudo make install

You can check if Ruby has been installed successfully by

$ ruby -v

and it should output

ruby 1.9.1p378 (2010-01-10 revision 26273) [i686-linux]

Should you see the “Happy new Ruby” returned, then your installation is ready to go

ruby -ropenssl -rzlib -rreadline -e "puts 'Happy new Ruby'"

Ruby 1.9 bundles RubyGem so you don’t have to install it
Install SQLite3 and MySQL 5.1

$ sudo apt-get install mysql-server-5.1 sqlite3

Please make sure you set a password for MySQL server.
Install Rails and essential gems

$ sudo gem update --system
$ sudo gem install mysql rails rack rake mysql sqlite3-ruby
$ sudo gem install ruby-debug19 -- --with-ruby-include=./ruby-1.9.1-p378/

We can check if all gems are installed successfully

$ gem list

and it should list

actionmailer (2.3.5)
actionpack (2.3.5)
activerecord (2.3.5)
activeresource (2.3.5)
activesupport (2.3.5)
rack (1.0.1)
rails (2.3.5)
rake (0.8.7)
mysql (2.8.1)
rubygems-update (1.3.5)
sqlite3-ruby (1.2.5)

Now you can generate your own Rails app.

source :