简体   繁体   English

如何在debian 6中安装ruby 2.0?

[英]how to install ruby 2.0 in debian 6?

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? 我想要安装ruby 2.0并且我已经遵循了很多教程,但是它们都没有工作,并且defaul repo apt-get install ruby为我带来了1.8版本(并且由于debian有限制更新它,如果不通过repo)有办法吗?

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 就这样,我在接下来的步骤中得到错误,当我做一个ruby -version我得到了这个

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

the end of the tuto install tuto安装结束

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? 任何想法如何在debian 6中这样做? thanks 谢谢

Compile it from the source. 从源代码编译它。

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

Get the latest stable Ruby 2.x, download the tarball, and compile it. 获取最新的稳定的Ruby 2.x,下载tarball并进行编译。 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. 你会感到惊讶的是,一切都将开箱即用,除了你升级到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 你的2.x将被安装到/usr/local/bin/ruby ,因此在我的一些本地脚本中,我不得不将shebang更改为#! /usr/local/bin/ruby #! /usr/local/bin/ruby to get them work with 2.x. #! /usr/local/bin/ruby让他们使用2.x. Ruby 1.9.3 will continue being available under /usr/bin/ruby . Ruby 1.9.3将继续在/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. 虽然大多数宝石完美地使用2.x,一些更复杂的宝石(例如watir-webdriver ),但我无法使用它,所以我仍然保持1.9.3左右。

(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.) (更新:现在看到更高版本的2.0和2.1,大多数宝石活着的开发者已经适应了Ruby 2.x.)

If it's a server, you may want to take a look at RVM ( https://rvm.io/ ). 如果它是服务器,您可能需要查看RVM( https://rvm.io/ )。 It would make your install as simple as : 这将使您的安装简单如下:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM