Capistrano Series - Installing Ruby, RubyGems and SQLite3

Continuing with setting up the Slice, now we need to install Ruby, RubyGems and SQLite.

We'll install Ruby via aptitude and then install RubyGems from source (as that will give us the latest version.)

Once done, we can go ahead and install SQLite3, a lightweight database, via aptitude.


Ruby and RubyGems

Installing Ruby via aptitude will give us the latest version (at the time of writing this article) and is a nice and easy way to ensure that if there are any security patches, they can be easily installed.

RubyGems will be installed via source code as the packaged version is 0.9.4 and the latest version is 1.3.5. It is highly recommended that you use the latest version, so take the time to install via source.

A full run down of installing Ruby and RubyGems is shown here.

Note, that article was written prior to this and as such, uses RubyGems 1.2. However, I would recommend using the latest available version in its place.

Once that is done, you should have the following Ruby version installed on your Slice:

# ruby -v

ruby 1.8.6 (2007-09-24 patchlevel 111) [x86_64-linux]

and RubyGems should output this:

# gem -v

1.3.5

sqlite3

In this application we're using SQLite3 as the db. You can, of course, use MySQL, PostgreSQL or any of the supported db's but for simplicity we're going to use sqlite3.

We already installed the main SQLite3 package when we installed Ruby and its dependencies. But now we need to install the SQLite3 ruby gem so that our rails app can make full use of SQLite3.

First we need to use aptitude to install the required dependencies:

sudo aptitude install libsqlite3-dev

Then all we need to do is this:

sudo gem install sqlite3-ruby

Note that I did see several "No definition for..." type warnings when installing the SQLite3 gem, but it continued to install fine anyway and should not pose any problems.

That's it for the database, but do ensure you have the required packages and libs installed on your local workstation (how you do this will depend on what OS and distro you are using on your workstation and is beyond these articles.)

Done

By now, you will see the complete setup starting to take shape - we have installed and secured the Slice and Git is up and running.

Now we can add to that list, as Ruby, RubyGems and SQLite3 are installed.

The next article will look at installing Apache with the passenger (mod_rails) module.

Once that is done, we'll move onto Capistrano and deploying our application.

Ben B.

Want to comment?


(not made public)

(optional)

(use plain text or Markdown syntax)