在 Ubuntu 上安装 Ruby 1.9.1?
我想知道如何在 Ubuntu 9.04 上安装最新版本的 Ruby。 现在我可以很好地运行 ./configure
和 make
内容,但我想知道的是:如何避免与打包系统发生冲突? 例如,如果我安装的其他某个包依赖于 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
省去麻烦,使用 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.
(http://www.ruby-lang.org/en/downloads/)
(http://www.ruby-lang.org/en/downloads/)
运行后,
它的解决方案是运行以下命令:
然后您将得到以下输出:
此解决方案的功劳归于回答 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
It's solution is to run the following command:
Then you will get this output:
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.
我的方法是使用 checkinstall 来构建它,它可以让你构建一个 deb 包。 所以我下载了 Ruby 1.9.1 源代码,执行了“configure”,然后“make”,执行了“checkinstall”并将软件包名称命名为 ruby1.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).
我从 此网站。
您可以使用 --prefix=/path 开关将大多数软件安装在不同的目录中。 通常安装在 /opt/ 中供您电脑上的每个人使用,或者安装在 $HOME 中(如果只适合您)。
对于在 /opt 中安装:
如果您想使用 /opt 安装的 ruby,请编辑 ~/.bashrc 并添加
如果您不想将自定义 Ruby 构建作为默认值,您可以将其添加到 ~/.bashrc而不是以前的命令
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:
If you want to use the /opt installed ruby, edit you ~/.bashrc and add
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
以下是安装 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
我为 ruby 1.9.2 创建了一个启动板 ppa。 详细信息请参见以下链接
http://www.humbug.in/2010/launchpad-ppa-for-ruby-1-9-2-and-some-ruby-bindings/
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/
通过 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 toruby1.8
, you should installruby1.9
explicitly – manually or via the repositories – and create the aliasruby
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.