简体   繁体   English

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

[英]Unable to install Ruby on Rails on Ubuntu 16.04 LTS

I just upgraded my system to Ubuntu 16.04 LTS (clean install) and tried to install Ruby using RVM. 我刚刚将系统升级到Ubuntu 16.04 LTS(全新安装),并尝试使用RVM安装Ruby。 RVM itself installs fine (using this guide http://www.webupd8.org/2014/11/how-to-install-rvm-ruby-version-manager.html ), but when I then try to install Ruby I get the following error: 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.

Is that a general problem for 16.04? 这是16.04的普遍问题吗? The exact method worked fine under 15.10. 确切的方法在15.10下效果很好。 Any ideas how this can be fixed? 任何想法如何解决?

It looks like rvm is trying to install the Ruby to /usr/share/rvm, which I think means that it's being installed at the system-wide level rather than the user level. 看起来rvm试图将Ruby安装到/ usr / share / rvm,我认为这意味着它是在系统级别而不是用户级别安装的。 Is that what you wanted? 那是你想要的吗? That being the case, it may be necessary to run rvm as sudo: 在这种情况下,可能有必要将rvm作为sudo运行:

user@user:~$ sudo rvm install 2.3.0

For what it's worth, I install rvm as me (my user) so that I don't have to mess with privileges; 为了值钱,我以我(我的用户)身份安装了rvm,这样我就不必打乱特权。 and I'm the only user on the system that needs rvm. 并且我是系统上唯一需要rvm的用户。

If you install rvm without sudo privileges, everything else should work as expected 如果您rvm 没有 sudo特权的情况下安装rvm ,则其他所有操作均应按预期进行

If you have rvm installed, remove it using 如果您安装了rvm,请使用

rvm implode

or 要么

rm -rf ~/.rvm

Then install rvm using 然后使用安装rvm

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

Then install ruby with 然后用

rvm install 2.3.0

Use whichever version you wanna install. 使用您想要安装的任何版本。

Now go ahead and install rails 现在继续安装滑轨

gem install rails

Try a reboot. 尝试重新启动。

I had the same problem with two installs of Ubuntu 16.04 Both computers had the same problem, it was fixed after I rebooted. 我在两次安装Ubuntu 16.04时遇到了相同的问题,两台计算机都遇到了相同的问题,在我重新启动后已得到解决。

rvm install ruby-2.5.0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM