Provide all Ruby Enterprise dependencies

I was trying to install Ruby Enterprise on my Ubuntu machine. I discover you need to be sure to have some package installed if you really want to build all gems needed by Ruby On Rails.
So be sure to install at least the headers for mysql and sqlite before installing Ruby Enterprise.

$ sudo apt-get install libmysqlclient-dev
$ sudo apt-get install libsqlite3-dev

Afterward you can compile the related gems with the following commands.

$ sudo /opt/ruby-enterprise-1.8.7-2010.02/bin/gem install mysql
$ sudo /opt/ruby-enterprise-1.8.7-2010.02/bin/gem install sqlite3-ruby

Worth reading

Ruby on CentOS

In these days I’m trying to install Ruby on Rails on our CentOS production server. What I really don’t like very much about CentOS are its pretty outdated packages installable via yum. This time proved to be the same… it’s seems that the Ruby available on CentOS via yum is a version released during 2006.
In the first place I tried to compile Ruby from sources, but this proved a little too much messy for me. In the end I stumbled upon Ruby Enterprise Edition and I gave it a try.
What I liked most about it was that it worked perfectly just out of the box and that all Ruby files go inside a single directory, so it’s pretty easy to move from a version to another even if not using yum.
This is a brief tutorial about how to install Ruby Enterprise Edition on CentOS.

Get rid of any Ruby previously installed

First of all let’s remove any Ruby installation already present on our CentOS.
We can ask Yum to give us a list of Ruby related packages currently installed.

  1. yum list | grep installed | grep ruby

My server answered that way, but obviously yours can show other answers.

  1. ruby.i386 1.8.5-5.el5_3.7 installed
  2. ruby-devel.i386 1.8.5-5.el5_3.7 installed
  3. ruby-libs.i386 1.8.5-5.el5_3.7 installed
  4. ruby-mode.i386 1.8.5-5.el5_3.7 installed

Time to gently ask to Yum to remove all those Ruby packages.

  1. yum erase ruby
  2. yum erase ruby-devel
  3. yum erase ruby-libs
  4. yum erase ruby-mode

We can now start with the Enterprise Ruby installation.

Download and install Enterprise Ruby

There is really nothing deeply interesting here. Just download the sources, unpack them, compile them and set some useful links.

  1. mkdir -p ~/Temp/Sources
  2. cd ~/Temp/Sources
  3. wget
  4. tar xzvf ruby-enterprise-1.8.7-2010.01.tar.gz
  5. ./ruby-enterprise-1.8.7-2010.01/installer

At the end we should have a working Ruby installation.
Let’s create some useful link.

  1. ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/rake /usr/bin/rake
  2. ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/gem /usr/bin/gem
  3. ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/rails /usr/bin/rails
  4. ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby /usr/bin/ruby
  5. ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/irb /usr/bin/irb

Worth reading

Cristian Livadaru’s blog post about the topic.
Install the available Ruby via Yum
Enterprise Ruby download page

Rails ans SQLite3 on Ubuntu

To configure a Rails application in order to use SQLite3 please follow the following steps:

sudo apt-get install  sqlite3 swig libsqlite3-ruby libsqlite3-dev
 sudo gem install sqlite3-ruby

Then create a Rails application as usual and update the environment.rb file in the following way do |config|
config.gem 'sqlite3-ruby', :lib => "sqlite3"