Making ruby available to all users
Don't dismiss RVM's value
You can use the repository version of Ruby but I would recommend going another way and using RVM to manage Ruby. I realize it might seem like it's slowing you down, but the version of Ruby that's deployed via the repositories though usable will often lead to problems down the road. It's generally best to create dedicated versions of interpreters and any required libraries (Gems) that can be dedicated to a particular application and/or use case.
RVM provides the ability to install for single user (which is what you did) as well as do a multi-user installation.
$ curl -L https://get.rvm.io | sudo bash -s stable
Running the installation this way will automatically trigger RVM to do a multi-user installation which will install the software under /usr/local/rvm
. From here the software can be accessed by anyone that's in the Unix group rvm
.
$ sudo usermod -a -G rvm <user>
Where <user>
would be the user webide
.
Installing a Ruby
Now add the following to each user's $HOME/.bashrc
. I generally put this at the end of the file:
[[ -s /usr/local/rvm/scripts/rvm ]] && source /usr/local/rvm/scripts/rvm
With that, you'll want to logout and log back in.
NOTE1: It isn't enough to start another tab in gnome-terminal, it needs to be a newly logged in session. This is so that the group you just added this user to, get's picked up.
NOTE2: You'll probably not have to add the above to your $HOME/.bashrc
if you find you have the following file installed here already, this does the above plus more for all users that are in the group rvm
on the system.
$ ls -l /etc/profile.d/rvm.sh
-rwxr-xr-x 1 root root 1698 Nov 27 21:14 /etc/profile.d/rvm.sh
Once logged in you'll need to install a Ruby. You can do this using the following steps, as user webide
.
What versions available to install?
$ rvm list known | less
...
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p374]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3[-p484]
[ruby-]2.0.0-p195
[ruby-]2.0.0[-p353]
[ruby-]2.1.0-preview2
[ruby-]2.1.0-head
ruby-head
...
NOTE: The 1st time you install a Ruby you should do this with a user that has sudo
rights so that dependencies can be installed. For example on Ubuntu, you'll see this type of activity. After these are installed other users, such as webide
, should be able to install additional Rubies too, into the directory /usr/local/rvm
.
Installing requirements for ubuntu.
Updating system..............................................................................................................
Installing required packages: libreadline6-dev, zlib1g-dev, libssl-dev, libyaml-dev, libsqlite3-dev, sqlite3, autoconf, libgdbm-dev, libncurses5-dev, automake, libtool, bison, libffi-dev...............................................................................................
Requirements installation successful.
Viewing installed versions
$ rvm list
rvm rubies
* ruby-1.9.3-p484 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Installing a 2nd Ruby
$ whoami
webide
$ rvm install 2.0.0-p195
...
ruby-2.0.0-p195 - #validate binary
ruby-2.0.0-p195 - #setup
Saving wrappers to '/usr/local/rvm/wrappers/ruby-2.0.0-p195'........
ruby-2.0.0-p195 - #importing default gemsets, this may take time..................
Now when we list what's installed:
$ rvm list
rvm rubies
* ruby-1.9.3-p484 [ x86_64 ]
ruby-2.0.0-p195 [ x86_64 ]
# => - current
# =* - current && default
# * - default
From the above we can see that user webide
was able to install a Ruby.
Setting a default for all rvm users
$ rvm use ruby-2.0.0-p195 --default
Using /usr/local/rvm/gems/ruby-2.0.0-p195
$ rvm list
rvm rubies
ruby-1.9.3-p484 [ x86_64 ]
=* ruby-2.0.0-p195 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Logging in as another user that's in the group rvm
we can see the effects of making ruby-2.0.0-p195
the default.
$ rvm list
rvm rubies
=> ruby-1.9.3-p484 [ x86_64 ]
* ruby-2.0.0-p195 [ x86_64 ]
# => - current
# =* - current && default
# * - default
So this user is using, ruby-1.9.3-p484
, and he's now configured to use ruby-2.0.0-p195
as the default too.
Slow downloads/installs
If you're experiencing a slow download you might want to make use of the offline installation method instead. This will allow you to do a re-install later on. Or perhaps the download via this system is problematic, and you could download the RVM installer on one system, and then use scp
to copy the installer to this system afterwards.
$ curl -L https://github.com/wayneeseguin/rvm/tarball/stable -o rvm-stable.tar.gz
See here, RVM in offline mode for full details.
References
- RVM ArchLinux Wiki
- Installing RVM - Quick (guided) Install