Tuesday, February 9, 2010

install ruby 1.9.1p376 on Ubuntu 9.10

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
-- http://www.ruby-lang.org/en/

wget -c ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p376.tar.gz

-- extract ruby source using tar

tar -xvzf ruby-1.9.1-p376.tar.gz

-- go to extracted ruby code dir

cd ruby-1.9.1-p376/

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

-- execute make command
make

-- 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 NLS_LANG=AMERICAN_AMERICA.UTF8
export PATH=$ORACLE_HOME/bin:$RUBY_HOME/bin:$JAVA_HOME/bin:$OC4J_HOME/bin:$ECLIPSE_HOME:$GROOVY_HOME/bin:$GRAILS_HOME/bin:$PATH

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.1p376 (2009-12-07 revision 26041) [x86_64-linux]


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

No comments:

Post a Comment