Ruby

From DreamHost

Jump to: navigation, search

Ruby is an object-oriented programming language the combines the features of other popular languages.

Contents

Ruby on DreamHost

DreamHost has upgraded their Ruby version. Ruby 1.8.5 is now located at /usr/bin/ruby.

DreamHost has also installed RubyGems as /usr/bin/gem You can see what items are installed by doing:

gem list

Installing Ruby 1.8.5

The current installed version is 1.8.5. You might need to do a similar process if you need a newer version.

Preparation: readline

In order to properly use the script/console and other features, you must have ruby installed with readline support. To do that, first install the Readline libraries in ${HOME}.


downloading and compiling

It's fairly easy to compile & install your own copy of Ruby into your home directory. You want to do this because 1) you get 1.8.5 and 2) you get an i686 version (compared to the i386 that's installed by default = faster).

First thing to do is log in to your account through ssh. Then, let's make a directory for the downloaded source:

mkdir src
cd src

Now, download and extract the Ruby source:

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.5-p12.tar.gz
tar xzvf ruby-1.8.5-p12.tar.gz
cd ruby-1.8.5-p12

And we're going to do a standard configure/make/make install to our home directory (these will take a few minutes):

./configure --prefix=$HOME --with-readline-dir=$HOME
make
make install

Then, we need to set our $PATH so that the new version is actually used:

cd
echo "export PATH=$HOME/bin:$PATH" >> .bash_profile
source .bash_profile

To check:

ruby -v; which ruby

you get:

ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-linux]
/home/username/bin/ruby

Installing version 1.8.6 with the Unix account setup

Prerequisites

Download, compile and install Ruby

cd ${HOME}/soft
wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6.tar.gz
tar xvzf ruby-1.8.6.tar.gz
cd ruby-1.8.6
./configure --prefix=${RUN} --with-readline-dir=${RUN}
make
make install
  • Now add a variable to your .bashrc so that programs find the Ruby libraries
cat >> ${HOME}/.bashrc <<eof
# ruby library search path
export RUBYLIB=\${RUN}/lib/ruby:\${RUN}/lib/rubyext
eof

See Also

Personal tools