Ruby 1.9.1, MySQL and Rails on Ubuntu 9.0.4
With the release of Rails 2.3.3 I decided to upgrade my rails projects. Not enough, I decided to upgrade to Ruby 1.9 as well.
So, here is my first impressions:
Ubuntu packages don't have a stable version of Ruby 1.9. They are still offering 1.9.0 and I heard 1.9.1 is much better and stable.
The solution was compile and install from the source.
so, just:
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p243.tar.gz
Then just:
tar xzf ruby-1.9.1-p243.tar.gz
and
cd ruby-1.9.1-p243
and
./configure
and
make
and
sudo make install
If everything went fine, you can just remove the src folder where did extracted you tar.gz. This will replace your ruby commando, pointing to ruby 1.9.1. To check that, please, verify with
ruby -v
Now you just need to install some gems to make your new ruby world rock. First, install Rails:
sudo gem install rails
Then, install your database adapters gems:
sudo gem install sqlite3-ruby pg
For mysql, try this: (Wasn't working when I wrote this post)
sudo gem install mysql
If don't work, then you will have to build it from source. Project page at http://www.tmtm.org/en/mysql/ruby
So
wget 'http://rubyforge.org/frs/download.php/51087/mysql-ruby-2.8.1.tar.gz'
then untar the file with
tar xzf mysql-ruby-2.8.1.tar.gz
access the directory you just extracted and do
ruby extconf.rb --with-mysql-config
and
make
Before finish, you can run a test to make sure it works. (You will need to install the test-unit gem):
ruby ./test.rb -- localhost your_user its_password the_database
If everything works as expected, just issue
sudo make install
And that's it. Hope it works well for you and you can enjoy the performance of Ruby 1.9.1