Thursday, April 16, 2009

Install ruby 1.9 on Ubuntu 9.04

First, remove any ruby version on the system:

sudo apt-get remove --purge ruby1.8 ruby1.9

-- package build dependencies (ruby)

sudo apt-get build-dep ruby1.9

-- get ruby 1.9 source
-- if you can't get it, try to download from

wget -c

-- extract ruby source using tar

tar -xvzf ruby-1.9.1-p0.tar.gz

-- go to extracted ruby code dir

cd ruby-1.9.1-p0/

-- execute configure
./configure --prefix=/opt/ruby-1.9.1-p0 --enable-pthread --enable-shared

-- execute make command

-- install process
sudo make install

Then I add the following line to the bottom of $HOME/.bash_profile

luan@luan-desktop:~$ cat .bash_profile
export OC4J_HOME=/opt/oc4j

export JAVA_HOME=/opt/java
export ECLIPSE_HOME=/opt/eclipse
export GROOVY_HOME=/opt/groovy

export GRAILS_HOME=/opt/grails
export TNS_ADMIN=/opt/oracle
export ORACLE_HOME=/u01/app/oracle/product/11.1.0/db_1
export RUBY_HOME=/opt/ruby


export AWT_TOOLKIT=MToolkit

Create a link:

luan@luan-desktop:/opt$ ln -s /opt/ruby-1.9.1-p0 /opt/ruby

luan@luan-desktop:/$ cd

luan@luan-desktop:/$ s
ource .bash_profile

luan@luan-desktop:/$ ruby -v
ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]

If you are using ruby gem, you need to type:
sudo /opt/ruby/bin/gem

No comments:

Post a Comment