简体   繁体   English

在Ubuntu上安装ruby / rails

[英]ruby/rails setup on ubuntu

I created a new VM using virtualbox and ubuntu 14. I then installed rvm using the following... 我使用virtualbox和ubuntu 14创建了一个新的VM。然后使用以下方法安装了rvm ...

\curl -sSL https://get.rvm.io | bash -s stable --ruby

I'm still quite new to ubuntu/linux so I'm trying to get a handle on the terminal commands. 我对ubuntu / linux还是很陌生,所以我正在尝试了解终端命令。 So, I think that I first did a 所以,我认为我首先做了

sudo su - 苏多苏-

thinking that this would allow me to specify my password once and then remember it for each command. 认为这将允许我一次指定密码,然后为每个命令记住密码。 But now I'm thinking that it instead changed me to the root account instead of my own? 但是现在我在想,它改为将我改为根帐户,而不是我自己的帐户? The reason I suspect this is because when I first open a terminal under my account and type in ruby -v, I get.. 我怀疑这是因为当我第一次在我的帐户下打开一个终端并输入ruby -v时,我得到了..

The program 'ruby' can be found in the following packages:
* ruby
* ruby 1.8
Try: sudo apt-get install <selected package>

If I then do a sudo su - and follow it with ruby -v, I get 如果然后执行sudo su-并使用ruby -v跟随它,我得到

ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]

So, I'm not sure if I've done something wrong with the rvm installation or if there's some way to get my own account to use the same version of ruby as root? 因此,我不确定rvm安装是否做错了什么,或者是否有某种方法可以让自己的帐户使用与root用户相同版本的ruby? Thanks. 谢谢。

From the comments, you seem to have installed RVM as root. 从注释中,您似乎已经以根用户身份安装了RVM。 Doing that will make RVM and its rubies only "visible" to the root user. 这样做将使RVM及其红宝石仅对root用户“可见”。 (Actually installing RVM for any user only makes it visible to that specific user AFAIK). (实际上,为任何用户安装RVM只会使其对特定用户AFAIK可见)。

To fix that, first remove the root RVM installation, run sudo su - to become root (if you aren't already - to check what user you are you can run whoami ). 要解决此问题,请首先删除root RVM安装,然后运行sudo su -成为root用户(如果还不是root用户-检查您是哪个用户,则可以运行whoami )。 Then run the following: 然后运行以下命令:

rvm implode

This removes RVM altogether. 这将完全删除RVM。

Next exit to become a normal user (again, check with whoami , if you're stuck just open a new terminal window) and run the RVM installation command: 下次exit以成为普通用户(再次,请与whoami检查,如果遇到问题,只需打开一个新的终端窗口)并运行RVM安装命令:

\curl -sSL https://get.rvm.io | bash -s stable --ruby

This should get you out of your problem. 这应该使您摆脱困境。

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

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