Ruby 2.2.0 installation on Ubuntu server (15.04) in custom location.

28 views
Skip to first unread message

Padmahas Bn

unread,
Nov 13, 2015, 11:51:07 PM11/13/15
to Ruby on Rails: Talk
Hello.

  I installed ruby 2.2.0 from source code on Ubuntu server 15.04 in "/home/padmahas/ruby/". It created 4 directories "bin", "include", "lib" and "share". But when I give the command "ruby -version", it says "the program ruby is currently not installed. You can install it by typing sudo apt-get install ruby".

So I cd to /home/padmahas/ruby/bin and executed the same command but surprisingly Ubuntu gave same error again. I also ensured that the current directory (bin) contains the program ruby in it by executing "ls" command. The directory contains several files such as, "erb", "gem", "irb", "rake", "rdoc", "ri" and "ruby".

Is it mandatory that I should set environment variable for ruby? If yes, why its not executing even from the bin directory?

I appreciate any suggestion or clue.

Thank you.

Colin Law

unread,
Nov 14, 2015, 3:12:17 AM11/14/15
to Ruby on Rails: Talk
On 14 November 2015 at 04:51, Padmahas Bn <padm...@gmail.com> wrote:
> Hello.
>
> I installed ruby 2.2.0 from source code on Ubuntu server 15.04 in
> "/home/padmahas/ruby/". It created 4 directories "bin", "include", "lib" and
> "share". But when I give the command "ruby -version", it says "the program
> ruby is currently not installed. You can install it by typing sudo apt-get
> install ruby".
>
> So I cd to /home/padmahas/ruby/bin and executed the same command but
> surprisingly Ubuntu gave same error again. I also ensured that the current
> directory (bin) contains the program ruby in it by executing "ls" command.
> The directory contains several files such as, "erb", "gem", "irb", "rake",
> "rdoc", "ri" and "ruby".

To run a program from the current directory you have to use ./ruby
otherwise it looks in the path first, I think. So the best thing is
to that folder to the path. However I strongly recommend using rvm
(or rbenv), rather than installing from source yourself. It is much
easier and you can install ruby and rails in a single command, plus
have access to different versions on the same machine very easily.

Colin

Colin Law

unread,
Nov 14, 2015, 11:32:16 AM11/14/15
to Ruby on Rails: Talk
Sorry, missed a word out that made part of my reply meaningless. The
offending sentence should have read "So the best thing is to *add*
that folder to the path". My suggestion to use rvm instead still
stands however.

Colin
Reply all
Reply to author
Forward
0 new messages