How to install ruby via source in Ubuntu

http://www.ruby-lang.org/en/downloads/. Dependency for Ruby and Ruby on Rails : libreadline, libyaml, libxml, libssl, zlib1g. In ubuntu you can have these libraries installed via the command line ( or if you are so old fashion you may google and find the source code for these packages as well)

$sudo apt-get install build-essentails zlib1g zlib1g-dev libreadline-dev libyaml-dev libssl-dev
After installing the dependency download the source code and extract it ( please not the installation will proceed if you miss some of the dependencies but missing then would make gem, bundle, irb to not function properly). First extarct the code :
$tar -zxvf [Name of ruby source code file].tar.gz
the configure the source code
$./configure
the finally you make and install
$make && sudo make install
To check if ruby is install you can use the command
$ruby -v
or try out interactive ruby (irb)
$irb
Now for those who are wondering how to install the latest version of rails, use the command:
$sudo gem install rails
]]>