Saturday, March 24, 2007

Ruby, the ghetto way (Ubuntu 6.10)

Quickie, Had my wisdom teeth out Friday, don't feel like sitting around here all night.

Before we start check and make sure your zlibs are up to date.
apt-get install zlibc zlib1g zlib1g-dev
sudo cp /usr/lib/ruby/1.8/i486-linux/zlib.so /usr/local/lib/ruby/site_ruby/1.8/i686-linux/

Install ruby now.

* Bring up the terminal, login as system root, and create temporary directory to store downloaded files.
[~/] su
[~/] mkdir local
[~/] cd local


* Download official source distribution. This will create a file named ruby-1.8.5.tar.gz in your local directory.
[~/local] wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz

* Extract all the files from downloaded archive. This will create local/ruby-1.8.5 subdirectory that stores extracted files.
[~/local] tar xvfz ruby-1.8.5.tar.gz

* Install GNU C++ compiler you'll need to build Ruby from source.
[~/local] apt-get install build-essential

* Run configure utility to determine your system configuration.
[~/local] cd ruby-1.8.5
[~/local/ruby-1.8.5] ./configure


* Run make command to compile and build Ruby.
[~/local/ruby-1.8.5] make

* Test newly built Ruby executable by running regression test suite. Upon successfull completion you'll see a message like: "Finished in 44.904424 seconds. 1440 tests, 13585 assertions, 0 failures, 0 errors."
[~/local/ruby-1.8.5] make test-all

* Install Ruby onto your system. This will move Ruby executable and utilities to /usr/local/bin and standard Ruby libraries to /usr/local/lib/ruby.
[~/local/ruby-1.8.5] make install

* Install Ruby documentation. This will compile Ruby documentation in format required for ri command.
[~/local/ruby-1.8.5] make install-doc

At this point the installation of Ruby 1.8.5 is complete. If you had previous version of Ruby installed in /usr/local/bin, you should take two extra steps:

* Make sure /usr/local/bin comes before /usr/bin in your $PATH:
[~/local/ruby-1.8.5] echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games


* Logout from your current terminal session and login again to reload hashed value of ruby:
[~/local/ruby-1.8.5] which ruby
/usr/local/bin/ruby
[~/local/ruby-1.8.5] ruby -v
ruby 1.8.5 (2006-08-25) [i686-linux]




Check it out.
Make sure you're running the latest version:
ruby -v
ruby 1.8.5 (2006-08-25) [i686-linux]

if so good!

Now pick up the GEM source http://rubyforge.org/frs/?group_id=126&release_id=9501

To Install gem:
tar -zxvf rubygems-0.9.2.tgz
cd rubygems-0.9.2
ruby setup.rb

make sure gem works:
gem -v
0.9.2

got it? good!

now run a sudo gem install Rails.

Say yes when it asks to install dependencies!

After GEM pulls down rails

make sure you're good to go:
rails -v
Rails 1.2.2

got it? Good!

Thats all for now.

No comments: