在 Ubuntu 上安装 Ruby 1.9.1?

发布于 2024-07-26 04:31:42 字数 235 浏览 7 评论 0原文

我想知道如何在 Ubuntu 9.04 上安装最新版本的 Ruby。 现在我可以很好地运行 ./configuremake 内容,但我想知道的是:如何避免与打包系统发生冲突? 例如,如果我安装的其他某个包依赖于 Ruby,那么包管理器是否会安装(过时的)Ruby 包并在最坏的情况下覆盖我的文件?

所以我想我需要某种方法来告诉 Ubuntu Ruby 实际上已经安装了?

I wonder about installing the latest version of Ruby on Ubuntu 9.04. Now I can run through the ./configure and make stuff fine, but what I wonder about: how to avoid conflicts with the packaging system? For example if some other package I install depends on Ruby, wouldn't the package manager install the (outdated) Ruby package and in the worst case overwrite my files?

So I think I need some way to tell Ubuntu that Ruby is in fact already installed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

那支青花 2024-08-02 04:31:42

省去麻烦,使用 RVM (Ruby 版本管理器)

请记住,Rails 3 最适合与 Ruby 1.9.2 配合使用。 Ruby 1.9.2 修复了 1.9.1 中的相当多的错误,并且比运行 1.9.1 更好。

使用 RVM 安装 1.9.2 变得轻而易举。

Save yourself the headache and use RVM (Ruby Version Manager)

Keep in mind, Rails 3 works best with Ruby 1.9.2. Ruby 1.9.2 fixes up quite a few bugs in 1.9.1 and is preferable to running 1.9.1.

With RVM installing 1.9.2 is a breeze.

我乃一代侩神 2024-08-02 04:31:42
sudo apt-get install ruby1.9.1-full

(http://www.ruby-lang.org/en/downloads/)

sudo apt-get install ruby1.9.1-full

(http://www.ruby-lang.org/en/downloads/)

怪我闹别瞎闹 2024-08-02 04:31:42

运行后,

sudo apt-get install ruby1.9.1-full

它的解决方案是运行以​​下命令:

sudo update-alternatives --config ruby

然后您将得到以下输出:

   There are 2 choices for the alternative ruby (providing /usr/bin/ruby).

     Selection    Path                Priority   Status
   ------------------------------------------------------------
   * 0            /usr/bin/ruby1.8     50        auto mode
     1            /usr/bin/ruby1.8     50        manual mode
     2            /usr/bin/ruby1.9.1   10        manual mode

   Press enter to keep the current choice[*], or type selection number: 2
   update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in    manual mode.
   $ ruby --version
   ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

此解决方案的功劳归于回答 https://askubuntu.com/questions/91693/how-do-you-uninstall-ruby-1-8-7 -and-install-ruby-1-9-2 。 目前ruby1.9.1包实际上是ruby 1.9.2。

After running

sudo apt-get install ruby1.9.1-full

It's solution is to run the following command:

sudo update-alternatives --config ruby

Then you will get this output:

   There are 2 choices for the alternative ruby (providing /usr/bin/ruby).

     Selection    Path                Priority   Status
   ------------------------------------------------------------
   * 0            /usr/bin/ruby1.8     50        auto mode
     1            /usr/bin/ruby1.8     50        manual mode
     2            /usr/bin/ruby1.9.1   10        manual mode

   Press enter to keep the current choice[*], or type selection number: 2
   update-alternatives: using /usr/bin/ruby1.9.1 to provide /usr/bin/ruby (ruby) in    manual mode.
   $ ruby --version
   ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]

Credit for this solution goes to person who answered https://askubuntu.com/questions/91693/how-do-you-uninstall-ruby-1-8-7-and-install-ruby-1-9-2 . Currently the ruby1.9.1 package is actually ruby 1.9.2.

失而复得 2024-08-02 04:31:42

我的方法是使用 checkinstall 来构建它,它可以让你构建一个 deb 包。 所以我下载了 Ruby 1.9.1 源代码,执行了“configure”,然后“make”,执行了“checkinstall”并将软件包名称命名为 ruby​​1.9,这样它就可以像新版本的 ruby​​ 1.9 一样安装(因为它应该)。

The way I did it was to build it using checkinstall which lets you build a deb package. So I downloaded the Ruby 1.9.1 source, did a "configure" and then "make", did a "checkinstall" and made the package name ruby1.9 so it installs as if it were a new version of ruby 1.9 (as it should).

眼眸里的那抹悲凉 2024-08-02 04:31:42

我从 网站。
您可以使用 --prefix=/path 开关将大多数软件安装在不同的目录中。 通常安装在 /opt/ 中供您电脑上的每个人使用,或者安装在 $HOME 中(如果只适合您)。

对于在 /opt 中安装:

$ ./configure –prefix=/opt/ruby
$ make install

如果您想使用 /opt 安装的 ruby​​,请编辑 ~/.bashrc 并添加

export PATH=/opt/ruby/bin/:$PATH

如果您不想将自定义 Ruby 构建作为默认值,您可以将其添加到 ~/.bashrc而不是以前的命令

function setupruby {
     export PATH=/opt/ruby/bin/:$PATH
}

I got the Ruby specific info from this site.
You can install most software in a different directory with the --prefix=/path switch. And it is common to install in /opt/ for everyone on your pc, or in $HOME if it is only for you.

For installing in /opt:

$ ./configure –prefix=/opt/ruby
$ make install

If you want to use the /opt installed ruby, edit you ~/.bashrc and add

export PATH=/opt/ruby/bin/:$PATH

If you don't want to have the custom Ruby build as default, you can add this to your ~/.bashrc instead of the former command

function setupruby {
     export PATH=/opt/ruby/bin/:$PATH
}
﹏雨一样淡蓝的深情 2024-08-02 04:31:42

以下是安装 1.9.1 并将其设置为默认版本的简短便捷方法:
http://michalf.我/博客:make-ruby-1-9-default-on-ubuntu-9-10-karmic-koala

Here is a short and convenient way to install 1.9.1 and to make it default:
http://michalf.me/blog:make-ruby-1-9-default-on-ubuntu-9-10-karmic-koala

七禾 2024-08-02 04:31:42

我为 ruby​​ 1.9.2 创建了一个启动板 ppa。 详细信息请参见以下链接

http://www.humbug.in/2010/launchpad-ppa-for-ruby-1-9-2-and-some-ruby-bindings/

sudo add-apt-repository ppa:pratikmsinha/ruby192+bindings
cd /etc/apt/sources.list.d/; sudo mv pratikmsinha-ruby192+bindings-lucid.list pratikmsinha-ruby192bindings-lucid.list
sudo aptitude update
sudo aptitude install ruby1.9.2

I created a launchpad ppa for ruby 1.9.2. Details in the links below

http://www.humbug.in/2010/launchpad-ppa-for-ruby-1-9-2-and-some-ruby-bindings/

sudo add-apt-repository ppa:pratikmsinha/ruby192+bindings
cd /etc/apt/sources.list.d/; sudo mv pratikmsinha-ruby192+bindings-lucid.list pratikmsinha-ruby192bindings-lucid.list
sudo aptitude update
sudo aptitude install ruby1.9.2
倦话 2024-08-02 04:31:42

通过 Synaptic,您似乎甚至不需要处理 Multiverse 或第三方存储库。 但由于 sudo apt-get install ruby​​ 当前安装了 ruby1.8 的别名,因此您应该显式安装 ruby1.9 – 手动或通过存储库 – 并自行创建别名 ruby

您可能希望将二进制文件放在 /usr/bin 中,因为发行版无论如何都会将其放置在其中。 不过,你的 PATH 上的任何地方都可以。

Looking through Synaptic it seems like you don't even have to deal with the Multiverse or third-party repositories. But since sudo apt-get install ruby currently installs an alias to ruby1.8, you should install ruby1.9 explicitly – manually or via the repositories – and create the alias ruby yourself.

You may want to put the binary in /usr/bin since that's where the distribution would put it anyway. Anywhere on your PATH is fine, though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文