简体   繁体   English

rbenv:在主目录外安装ruby

[英]rbenv: install ruby out of home-directory

I'm trying to install Ruby + Rails on Ubuntu 14.04. 我正在尝试在Ubuntu 14.04上安装Ruby + Rails。 I need more than one user to have access to Ruby, so I installed rbenv with ruby-build in the /opt/.rbenv directory. 我需要一个以上的用户才能访问Ruby,因此我在/opt/.rbenv目录中使用ruby-build安装了/opt/.rbenv Is that right? 那正确吗?

If I try to install a version of Ruby using 如果我尝试使用安装Ruby版本

rbenv install 2.1.3

it is installed in ~/username/.rbenv/versions , not in /opt/.rbenv/versions . 它安装在~/username/.rbenv/versions ,而不是安装在/opt/.rbenv/versions

I don't want to give the second user access to the other user's home directory. 我不想让第二个用户访问另一个用户的主目录。

How can I install Ruby in /opt/.rbenv ? 如何在/opt/.rbenv安装Ruby? Or is there another solution? 还是有其他解决方案?

You can use the RBENV_ROOT environment variable: 您可以使用RBENV_ROOT环境变量:

sudo RBENV_ROOT=/opt/.rbenv rbenv install 2.1.3

See documentation . 请参阅文档

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

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