开发者

Why can't I perform a multi-user RVM install in Ubuntu 11.04?

I'm trying to install RVM into /usr/local/rvm because I need the ability to run ruby as a server. However, whenever I run:

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

it defaults to my home directory, /home/<user>/.rvm.

I've tried running:

sudo bash < <(curl -s https://rvm.beginrescueend.com/i开发者_运维问答nstall/rvm)

as well as enabling the Ubuntu root password and logging in with the root account, but the install always defaults to my home directory. How can I fix this, or would it be easier to just install Ruby from source?


In my opinion, RVM on a production host isn't as useful as it is for a developer's sandbox. I think RVM is a great tool but it isn't for every situation.

Developers need a lot of flexibility for using different versions of Ruby, and for using specific versions of gems. RVM shines for that. It makes it easy to switch automatically, to test against all versions of Ruby installed, or, if things go haywire, to blow it all away and start over quickly.

In a production server environment, where you generally dedicate a host to a particular service, or a set of related services, the need to quickly switch between various Rubies and gem sets tends to disappear. I put only one version of Ruby on mine. All apps point at it. IF I needed more than one, I'd install it into a separate /opt or /local directory hierarchy, and set my PATH for the owning account to point to the needed version. In production that's usually a set once and forget situation.


You can install rvm in multi-user mode on Ubuntu. The instructions are the same as for other systems, as described here http://beginrescueend.com/rvm/install/ Just install it using sudo.

However, there is a different issue with Ubuntu that will fail subsequent commands like sudo rvm install 1.9.2 because of the way Ubuntu implement the sudo command. On ubuntu, sudo changes the path by default, to make it more secure. This earlier thread discusses the issue in detail sudo changes PATH - why?

To workaround this problem, edit your sudoers file with visudo and add specify

Defaults !secure_path

as suggested on the related thread.


When you are logged in as root check if rvm_path is set:

echo $rvm_path

If it is, then:

export rvm_path=
rm /etc/rvmrc

This should be enough.


To be sure, try sudo su -c bash < <(...). You can use sudo without having a root user account on the system (that's how OSX was configured when I bought it), so you should be careful with sudo. Also, for example, sudo su -c env has a different path than sudo env in my Ubuntu install.

Also, note that after the install (you can't sudo a function) you need to use rvmsudo rvm ... instead of sudo rvm ... if you aren't logged in as root (i.e. maybe you should sudo su then do your work).


Instead of running commands with sudo or enabling the root password, try this:

$ sudo su -

This will switch you to the root account where you can run the install command:

# bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

That worked for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜