无法在Ubuntu 16.04 LTS上安装Ruby on Rails

时间:2016-04-27 17:57:59

标签: ruby-on-rails ruby ubuntu rvm ubuntu-16.04

我刚刚将系统升级到Ubuntu 16.04 LTS(干净安装)并尝试使用RVM安装Ruby。 RVM本身安装正常(使用本指南http://www.webupd8.org/2014/11/how-to-install-rvm-ruby-version-manager.html),但当我尝试安装Ruby时,我收到以下错误:

user@user:~$ rvm install 2.3.0
Searching for binary rubies, this might take some time.  
No binary rubies available for: ubuntu/16.04/x86_64/ruby-2.3.0.  
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for ubuntu.  
Requirements installation successful.  
Installing Ruby from source to: /usr/share/rvm/rubies/ruby-2.3.0, this may take a while depending on your cpu(s)...  
ruby-2.3.0 - #downloading ruby-2.3.0, this may take a while depending on your connection...  
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current Dload  Upload   Total   Spent    Left  Speed  
     0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0  
Warning: Failed to create the file ruby-2.3.0.tar.bz2.part: Permission denied  
0 13.5M    0 16384    0     0  19826      0  0:11:55 --:--:--  0:11:55 19811  
curl: (23) Failed writing body (0 != 16384)  
There was an error(23).  
Checking fallback: https://ftp.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.bz2
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current Dload  Upload   Total   Spent    Left  Speed
     0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
Warning: Failed to create the file ruby-2.3.0.tar.bz2.part: Permission denied  
     0 13.5M    0 16149    0     0   7324      0  0:32:16  0:00:02  0:32:14  7323  
curl: (23) Failed writing body (0 != 16149)  
There was an error(23).  
Failed download  
There has been an error fetching the ruby interpreter. Halting the installation.

这是16.04的普遍问题吗?确切的方法在15.10下工作正常。任何想法如何解决这个问题?

3 个答案:

答案 0 :(得分:0)

看起来rvm正在尝试将Ruby安装到/ usr / share / rvm,我认为这意味着它是在系统级而不是用户级安装的。那是你想要的吗?在这种情况下,可能需要将rvm作为sudo运行:

user@user:~$ sudo rvm install 2.3.0

为了它的价值,我安装rvm作为我(我的用户),这样我就不必乱用特权;而且我是系统中唯一需要rvm的用户。

答案 1 :(得分:0)

如果你安装rvm 没有 sudo权限,其他一切都应按预期工作

如果您安装了rvm,请使用

将其删除
rvm implode

rm -rf ~/.rvm

然后使用

安装rvm
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash -s stable

然后用

安装ruby
rvm install 2.3.0

使用您要安装的任何版本。

现在继续安装rails

gem install rails

答案 2 :(得分:0)

尝试重新启动。

我在两次安装Ubuntu 16.04时遇到了同样的问题 两台计算机都有同样的问题,我重新启动后修复了它。

rvm install ruby-2.5.0