Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to install ruby 2.0 in debian 6?

Tags:

ruby

debian

I want o install ruby 2.0 and I have followed many tutorials, but none of them works, and the defaul repo apt-get install ruby brings me the 1.8 version (and due is debian has restrictions to update it if is not through the repo) any way to do it?

Ive tried this way

cd /usr/src
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p0.tar.gz
tar xjf ruby.xxx.tar.bz2
cd rubyxxx
./configure --enable-shared
make 
make install

and just that, I get error on the next steps, when I make a ruby -version I get this

-bash: /usr/bin/ruby: No such file or directory

the end of the tuto install

cd ext/openssl/
ruby extconf.rb
make install

cd ../readline/
ruby extconf.rb
make install

gem update --system

any idea how to do this in debian 6? thanks

like image 989
jpganz18 Avatar asked May 02 '13 18:05

jpganz18


2 Answers

Compile it from the source.

Go here: https://www.ruby-lang.org/en/downloads/

Get the latest stable Ruby 2.x, download the tarball, and compile it. You will be surprised that everything will actually work out of the box, except that you'll have to reinstall the gems once you upgrade to 2.x. Your 2.x will be installed into /usr/local/bin/ruby, so in some of my local scripts, I had to change the shebang to #! /usr/local/bin/ruby to get them work with 2.x. Ruby 1.9.3 will continue being available under /usr/bin/ruby. I'm no theorist or core developer, but this is my experience as a user. And while most gems work with 2.x perfectly, some more complicated ones (such as watir-webdriver), I wasn't able to get working with it, so I still keep 1.9.3 around.

(Update: Now with higher versions of 2.0 and 2.1 in sight, most developers whose gems are alive already adapted to Ruby 2.x.)

like image 168
Boris Stitnicky Avatar answered Nov 17 '22 10:11

Boris Stitnicky


If it's a server, you may want to take a look at RVM (https://rvm.io/). It would make your install as simple as :

curl -L https://get.rvm.io | bash -s stable --rails --autolibs=enabled

like image 41
Martin Avatar answered Nov 17 '22 10:11

Martin