如何让Ruby 1.9成为Ubuntu的默认Ruby ?

时间:2023-02-02 19:19:41

Is there any way, on Ubuntu 9.04, to install Ruby 1.8 as ruby1.8 (or get rid of it altogether) and have Ruby 1.9 be the default ruby?

在Ubuntu 9.04上,有没有办法把Ruby 1.8安装成ruby1.8(或者干脆把它删掉),让Ruby 1.9成为默认的Ruby呢?

5 个解决方案

#1


106  

I'm not really sure, but maybe this can help:

我不太确定,但也许这能帮上忙:

update-alternatives --config ruby

... and here's the non-interactive, scriptable, way:

…这是一种非交互式的,可脚本化的方式:

update-alternatives --set ruby /usr/bin/ruby1.9.1

You may find out about available alternatives and respective /usr/bin/... paths by doing:

您可以找到可用的替代方案和各自的/usr/bin/…路径通过:

update-alternatives --query ruby

#2


6  

Martin - Take a look at the following link: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

Martin -看看下面的链接:http://ryanbigg.com/2010/12/ubuntu-ruby-rvm- rail-you/

This is where installation of ruby is heading for ubuntu servers. This should allow you to not only switch to a ruby version when needed, but also keep gems separated based on ruby versions, etc.

这就是ruby安装在ubuntu服务器上的地方。这不仅允许您在需要时切换到ruby版本,而且还可以根据ruby版本将gems分离,等等。

#3


3  

You can completely remove Ruby 1.8 too with:

您也可以完全删除Ruby 1.8与:

sudo apt-get remove libruby1.8 ruby1.8 ruby1.8-dev rubygems1.8

After that, you will only have Ruby 1.9 installed.

之后,您将只安装Ruby 1.9。

#4


2  

sudo \curl -L https://get.rvm.io | bash -s stable --ruby --rails

will install an up-to-date version of ruby (and rails), and allow you to avoid brokenness of Ubuntu's RVM, see https://*.com/a/9056395/497756.

将安装最新版本的ruby(和rails),并允许您避免Ubuntu的RVM损坏,参见https://*.com/a/9056395/497756。

If you go this route, get rid of Ubuntu-installed versions and associated packages like bundle.

如果您采用这种方式,请删除ubuntu安装的版本和相关包(如bundle)。

Details here: https://rvm.io/rvm/install/

细节:https://rvm.io/rvm/install/

(Note: this is the TL;DR version of the post by henry74.)

(注:这是henry74写的TL;DR版本。)

#5


-2  

Try this:

试试这个:

sudo apt-get install ruby1.9.1 rubygems1.9.1

or try building from source. this worked for me on ubuntu 9.04 and after a restart 1.9 was the standard ruby

或者尝试从源头上构建。这对我在ubuntu 9.04上是有效的,在重启1.9之后是标准的ruby

#1


106  

I'm not really sure, but maybe this can help:

我不太确定,但也许这能帮上忙:

update-alternatives --config ruby

... and here's the non-interactive, scriptable, way:

…这是一种非交互式的,可脚本化的方式:

update-alternatives --set ruby /usr/bin/ruby1.9.1

You may find out about available alternatives and respective /usr/bin/... paths by doing:

您可以找到可用的替代方案和各自的/usr/bin/…路径通过:

update-alternatives --query ruby

#2


6  

Martin - Take a look at the following link: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

Martin -看看下面的链接:http://ryanbigg.com/2010/12/ubuntu-ruby-rvm- rail-you/

This is where installation of ruby is heading for ubuntu servers. This should allow you to not only switch to a ruby version when needed, but also keep gems separated based on ruby versions, etc.

这就是ruby安装在ubuntu服务器上的地方。这不仅允许您在需要时切换到ruby版本,而且还可以根据ruby版本将gems分离,等等。

#3


3  

You can completely remove Ruby 1.8 too with:

您也可以完全删除Ruby 1.8与:

sudo apt-get remove libruby1.8 ruby1.8 ruby1.8-dev rubygems1.8

After that, you will only have Ruby 1.9 installed.

之后,您将只安装Ruby 1.9。

#4


2  

sudo \curl -L https://get.rvm.io | bash -s stable --ruby --rails

will install an up-to-date version of ruby (and rails), and allow you to avoid brokenness of Ubuntu's RVM, see https://*.com/a/9056395/497756.

将安装最新版本的ruby(和rails),并允许您避免Ubuntu的RVM损坏,参见https://*.com/a/9056395/497756。

If you go this route, get rid of Ubuntu-installed versions and associated packages like bundle.

如果您采用这种方式,请删除ubuntu安装的版本和相关包(如bundle)。

Details here: https://rvm.io/rvm/install/

细节:https://rvm.io/rvm/install/

(Note: this is the TL;DR version of the post by henry74.)

(注:这是henry74写的TL;DR版本。)

#5


-2  

Try this:

试试这个:

sudo apt-get install ruby1.9.1 rubygems1.9.1

or try building from source. this worked for me on ubuntu 9.04 and after a restart 1.9 was the standard ruby

或者尝试从源头上构建。这对我在ubuntu 9.04上是有效的,在重启1.9之后是标准的ruby