Is a system-wide install of RVM a bad idea? [close

2019-02-02 00:22发布

I'm confused about whether, on a server, you're supposed to install RVM as a regular user or do a system-wide installation, and, if the latter, how you're supposed to do things like bundle install without using sudo.

Is there any definite set of guidelines on what you're supposed to do as far as RVM is concerned on a server running Rails under e.g. Passenger and Nginx? In this type of environment, not all Ruby processes run under the same user, so I think that's where things get unclear as far as RVM and bundler are concerned.

How about just avoiding RVM all together on the server and just installing Ruby and gems the old fashioned way there? Is that preferable if you can get away with it?

3条回答
beautiful°
2楼-- · 2019-02-02 00:36

RVM may be installed as super user. While it doesn't need to be, there are a lot of advantages to doing so (especially on a multi-user system). Any commands that come with Ruby (and associated Ruby Gems) should have their permissions set correctly to be run appropriately. Bundle does not require super user access to be used. It can run under a particular user, just as gem install can be local to a user or system wide when done with a full sudo.

RVM only manages your particular installs of Ruby, so that you can develop on multiple levels of Ruby- From RMI 1.8 and 1.9 to JRuby 1.6, et cetera. You may have different projects you are working on, and therefore need differing needs per project.

As far as on a server itself goes (assuming it's an external facing server with some kind of content on it), that just depends on the system administrators really. The use case changes somewhat. If you only need Ruby 1.9 on the server, there's really no need for RVM. Because managing multiple versions of Ruby is not required. So I would take that in to account when you decide whether to go system wide on a server itself.

Hope that helps!

查看更多
戒情不戒烟
3楼-- · 2019-02-02 00:41

You could install RVM as a regular user, although I don't see the point. Bundler is per-application and doesn't need sudo privileges since it can install your gems into a bundle directory that the bundle install user can access with, for instance:

bundle install --deployment

which will put them in vendor/bundle by default.

I think of RVM as a development tool for managing multiple ruby versions. On deployment machines I tend to either use system Ruby or install from source.

查看更多
forever°为你锁心
4楼-- · 2019-02-02 00:44

I would highly recommend doing a system-wide install for a production environment. Running user-specific RVMs just seems like a huge hassle. I use Passenger/Nginx in production and each project has its own users. All I have to do is add them to the rvm group and I'm good to go.

查看更多
登录 后发表回答