简体   繁体   中英

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. 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:

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? The exact method worked fine under 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. Is that what you wanted? That being the case, it may be necessary to run rvm as 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; and I'm the only user on the system that needs rvm.

If you install rvm without sudo privileges, everything else should work as expected

If you have rvm installed, remove it using

rvm implode

or

rm -rf ~/.rvm

Then install rvm using

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.

rvm install ruby-2.5.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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