Friday, April 9, 2010

Installing basic ruby support

Previous: Rethinking directory structure

Still recovering from the system problem reported earlier.

I documented this before, but I've learned a few things since then so some of these steps may be a bit different. If you're using this as a guide for setting up your own Ubuntu system, I'd suggest using the latest posts on each topic.

First, I need support for git:

sudo apt-get install git-core

I want to install various software development tools. Let's start with Ruby. I'll take care of plug-ins and so forth later, when setting up specific projects. For the moment I just want to get basic tools installed.

sudo apt-get install ruby-full

and verify it worked

ruby -v

Also need ruby gems support. The ruby community reports problems when apt is used to install rubygems. The following procedure is recommended instead.

Take your browser to http://rubyforge.org/frs/?group_id=126. In the list of available downloads, hover the mouse cursor over the name of the one you want to see which URL would be downloaded (but don't download it yet). In my case, the URL was http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz.

The key elements to note are the numerical path segment 69365 and the version number, 1.3.6. These elements will vary as new releases are posted. Not very RESTful, I suppose.

Armed with this information, get rubygems this way:

cd ~
wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
tar xzvf rubygems-1.3.6.tgz
cd rubygems-1.3.6
sudo ruby setup.rb

The setup.rb script will display the name of the rubygems executable on the console, like this:

RubyGems installed the following executables:
/usr/bin/gem1.8

Use the name to set a symlink like the following

sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

and verify it worked

cd ~
gem -v

It will display the version number of gems that is installed. This should match the version number you found on rubyforge.

Now you can delete the installation directory and the tarball:

rm -r rubygems-1.3.6
rm rubygems-1.3.6.tgz

Note that the software is installed under /usr. This is the reason I decided to mount /usr from its own partition. I will be able to repair or upgrade Ubuntu itself without having to reinstall all my software piece by piece.

Next: Installing MySQL, admin tools, and ruby bindings

No comments:

Post a Comment