Ruby-on-rails 我可以在 Ubuntu 上使用 apt-get 安装 gems 吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5736568/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I install gems with apt-get on Ubuntu?
提问by Genadinik
I am new to Ruby and just diving in. The Ruby tutorial says I should get the packaging system from here: http://rubyforge.org/frs/?group_id=126
我是 Ruby 新手,刚开始学习。Ruby 教程说我应该从这里获取打包系统:http: //rubyforge.org/frs/?group_id=126
I am on Ubuntu Linux. The page has a .tar and a .gem option for downloading. Which should I download?
我在 Ubuntu Linux 上。该页面有一个 .tar 和一个 .gem 选项供下载。我应该下载哪个?
Also, are gems exactly analogous to Java jars? And why do I need the gem packaging system if I can just download gems one by one as they are needed?
另外,gems 是否与 Java jar 完全类似?如果我可以根据需要一一下载 gem,为什么还需要 gem 打包系统?
采纳答案by Mike
First, download *.tar file, unpack this file, then go to rubygems directory in your console, and type
首先,下载 *.tar 文件,解压该文件,然后进入控制台中的 rubygems 目录,然后键入
ruby setup.rb
That's it :)
就是这样 :)
回答by Yada
Ubuntu now have rubygems as a package
Ubuntu 现在有 rubygems 作为一个包
For Ubuntu 12:
对于 Ubuntu 12:
sudo apt-get install rubygems
For Ubuntu 14.04:
对于 Ubuntu 14.04:
sudo apt-get install rubygems-integration
回答by plowman
On Ubuntu 16.04and Ubuntu 18.04, both sudo apt-get install rubygemsand sudo apt-get install rubygems-integrationfailed for me. Instead, I had to do this:
在Ubuntu的16.04和Ubuntu的18.04,既sudo apt-get install rubygems和sudo apt-get install rubygems-integration失败对我来说。相反,我必须这样做:
sudo apt-get install ruby-dev
回答by Bikramjit Singh
If on Ubuntu 14.04 try below
如果在 Ubuntu 14.04 上尝试以下
sudo apt-get install rubygems-integration
回答by briankip
If you install the full ruby application set with
如果您安装了完整的 ruby 应用程序集
sudo apt-get install ruby-full
sudo apt-get install ruby-full
You will get gems and much more by default. Tested on Ubuntu 16, it could also work on other version.
默认情况下,您将获得宝石等等。在 Ubuntu 16 上测试过,它也可以在其他版本上运行。
回答by Ashish Gupta
For Ubuntu
对于 Ubuntu
First install ruby:
首先安装红宝石:
sudo apt install ruby
Note that : sudo snap install rubywill throw this error :
请注意:sudo snap install ruby将抛出此错误:
error: This revision of snap "ruby" was published using classic confinement and thus may perform arbitrary system changes outside of the security sandbox that snaps are usually confined to, which may put your system at risk.
If you understand and want to proceed repeat the command including --classic.
错误:快照“ruby”的此修订版是使用经典限制发布的,因此可能会在快照通常限制的安全沙箱之外执行任意系统更改,这可能会使您的系统处于危险之中。
If you understand and want to proceed repeat the command including --classic.
Finally, download latest tar version of ruby gems here: https://rubygems.org/pages/download
最后,在这里下载最新的 tar 版本的 ruby gems:https: //rubygems.org/pages/download
Unzip and cd to the folder and finally type in terminal:
解压并 cd 到文件夹,最后输入终端:
sudo ruby setup.rb

