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
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.
yum list | grep installed | grep ruby
My server answered that way, but obviously yours can show other answers.
ruby.i386 1.8.5-5.el5_3.7 installed
ruby-devel.i386 1.8.5-5.el5_3.7 installed
ruby-libs.i386 1.8.5-5.el5_3.7 installed
ruby-mode.i386 1.8.5-5.el5_3.7 installed
Time to gently ask to Yum to remove all those Ruby packages.
yum erase ruby
yum erase ruby-devel
yum erase ruby-libs
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.
mkdir -p ~/Temp/Sources
tar xzvf ruby-enterprise-1.8.7-2010.01.tar.gz
At the end we should have a working Ruby installation.
Let’s create some useful link.
ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/rake /usr/bin/rake
ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/gem /usr/bin/gem
ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/rails /usr/bin/rails
ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby /usr/bin/ruby
ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/irb /usr/bin/irb
Cristian Livadaru’s blog post about the topic.
Install the available Ruby via Yum
Enterprise Ruby download page
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
Rails::Initializer.run do |config|
config.gem 'sqlite3-ruby', :lib => "sqlite3"