- ∞Installing RVM
- ∞Install GPG keys
- ∞Basic install
- ∞Ubuntu
- ∞Any other system
- ∞You can also:
- ∞Installation explained
- ∞Installation
- ∞1. Download and run the RVM installation script
- Single-User Install Location:
- Multi-User Install Location: /usr/local/rvm
- External tutorials
- To update an existing RVM installation
- ∞2. Load RVM into your shell sessions as a function
- Single-User:
- Multi-User:
- Mixed mode (user gemsets):
- ∞3. Reload shell configuration & test
- Congratulations! You have successfully installed RVM.
- ∞Try out your new RVM installation
- ∞Enjoy using RVM!
- ∞Where to now?
- ∞Troubleshooting Your Install
- Install rvm on linux
- Contents
- Installing RVM
- Pre-requisites
- Single-user installation
- Multi-user installation
- A cautionary action
- Post Installation
- Some extras
- Using RVM
- Rubies
- Installing environments
- Switching environments
- System ruby
- Listing environments
- Gemsets
- Creating
- Using
- Listing
- Deleting
- Emptying
- Updating
- Uninstalling
- Further Reading
- Troubleshooting
- «data definition has no type or storage class»
- Ruby 1.8.x will not compile with RVM
- Ruby 1.9.1 will not compile with RVM
- Ruby 2.2.2 will not compile with RVM
- Ruby 2.3.1 will not compile with RVM
- RVM uses wrong OpenSSL version
∞Installing RVM
RVM supports most UNIX like systems and Windows (with Cygwin or Bash on Ubuntu on Windows). The basic requirements are bash , curl , gpg2 and overall GNU version of tools — but RVM tries to autodetect it and install anything that is needed.
∞Install GPG keys
As a first step install GPG keys used to verify installation package:
In case you encounter an issues check security
∞Basic install
∞Ubuntu
RVM have dedicated Ubuntu package, so please follow instructions posted here: https://github.com/rvm/ubuntu_rvm
If you need a different (newer) version of RVM, after installing base version of RVM check the Upgrading section.
∞Any other system
Install RVM (development version):
Install RVM stable with ruby:
Additionally with rails (poor man’s railsinstaller):
Or with jruby, rails and puma:
To install without rubygems-bundler and rvm gems (and also remove those gems from both global.gems and default.gems):
To install with hirb gem (and also add it to global.gems):
To install with rails and haml gems (and also add them to default.gems):
For a progress bar when downloading RVM / Rubies:
Point to be noted is, there is a backslash before curl. This prevents misbehaving if you have aliased it with configuration in your
If you’re an existing RVM user and you don’t want RVM to attempt to setup your shell to load RVM, you can opt out of this at install time by exporting rvm_ignore_dotfiles=yes, or opt out permanently by setting this in your rvmrc.
∞You can also:
- read the installation documentation below.
- watch the most accurate (but not official) rvm screencast.
- read the most accurate (but not official) rvm cheat sheet.
- starting with Rails? watch the RailsCasts.com on Getting Started with Rails.
∞Installation explained
There are three different ways to install and configure RVM.
- Single-User installations ( recommended ) — For an isolated install within a user’s $HOME, not for root.
- Multi-User installations — For server administrators — For an installation usable by all users on the system — Please note that Single-User supersedes Multi-User. This also used to be called the System-Wide Install. Using this type of installation without knowledge how umask works is a big security risk.
- Mixed mode installations — For an installation usable by all users on the system — with isolated rubies/gemsets within a user’s $HOME. Installation instructions are exactly the same as for Multi-User installations, the difference is in users environment.
∞Installation
I recommend you read the installation script yourself. This will give you a chance to understand what it is doing before installing, and allow you to feel more comfortable running it if you do so.
∞1. Download and run the RVM installation script
Installing the stable release version:
To get the latest development state:
Instruct RVM to not change the shell initializations files ‘rc’ / ‘profile’:
Please note that from this point it is user responsibility to add sourcing rvm to appropriate files.
For a Multi-User install you would execute the following:
Note: The Multi-User install instructions must be prefixed with the sudo command. However, once the install is complete, and the instructions to add users to the rvm group is followed, the use of either sudo or rvmsudo is no longer required. The sudo command is only to temporarily elevate privileges so the installer can complete its work. If you need to use sudo or rvmsudo after the install is complete, some part of the install directions were not properly followed. This usually is because people execute the install as root , rather than executing the installation instructions from a non-privileged user account.
Installing a specific version:
Prefix the ‘bash’ portion with ‘sudo’, of course, if you wish to apply this to a Multi_user Install. Please feel free to check out our upgrading docs for more details on branch format.
Debugging installation process:
If the rvm install script complains about certificates you need to follow the displayed instructions.
Single-User Install Location:
If the install script is run as a standard, non-root user, RVM will install into the current users’s home directory.
Modification of user configuration files ( *rc / *profile ) — RVM by default will modify user startup files, although it is not recommended you can disable automated process and do this manually:
Multi-User Install Location: /usr/local/rvm
If the install script is run prefixed with sudo, RVM will automatically install into /usr/local/rvm . Please see the troubleshooting page for an important note regarding Multi-User Installs.
Please see the FAQ page for an important note regarding root only installs.
External tutorials
Note that that any outside tutorials are NOT supported whether they work or not. Tutorials are great, however we have spent massive amounts of man hours debugging the installation process. Please use the install process(es) from this site only, as this is the only supported installation types and methods.
To update an existing RVM installation
It is safe to simply re-run the installation script again, or you can follow the upgrading docs.
∞2. Load RVM into your shell sessions as a function
Single-User:
The rvm function will be automatically configured for every user on the system if you install as single user. Read the output of installer to check which files were modified.
Multi-User:
The rvm function will be automatically configured for every user on the system if you install with sudo. This is accomplished by loading /etc/profile.d/rvm.sh on login. Most Linux distributions default to parsing /etc/profile which contains the logic to load all files residing in the /etc/profile.d/ directory. Once you have added the users you want to be able to use RVM to the rvm group, those users MUST log out and back in to gain rvm group membership because group memberships are only evaluated by the operating system at initial login time. Zsh not always sources /etc/profile so you might need to add this in /etc/**/zprofile :
Mixed mode (user gemsets):
- After following above instructions for Multi-User.
- Select a user as a manager — he will be responsible for installing new rubies. This user should never run the command introduced below. If this happens, remove/rename the $
/.rvmrc , logout and then relogin. Otherwise you won’t be able to install/upgrade new rubies correctly.
For each user that want to use RVM, an additional command needs to be run (once) for each user:
Gemsets created by these users will be hosted in their HOME directory. It’s not possible to use global gemsets from system without using tricks like manually linking directories and they should not be used in mixed-mode. Please bear in mind that ‘system’ in this context does not refer to your distribution’s ruby packages, but to the RVM Multi-User installation.
You have two possibilities to manage RVM. The first one is to add managers to the rvm group. The second one is to use separate managers with rvmsudo and privilege escalation. Note that it is not safe to use rvmsudo from mixed mode user. Both can be mixed without any side-effect. It is however very important to not enable mixed-mode gemsets or rubies for the managers. RVM is using a custom umask ( umask u=rwx,g=rwx,o=rx ) when installing gemsets, rubies, updating itself, etc. This should not impact your system. But if you prefer to avoid RVM messing around with your umask, you can comment the umask line in /etc/rvmrc .
This mode should also works with passenger, please follow passenger instructions. .
∞3. Reload shell configuration & test
Close out your current shell or terminal session and open a new one (preferred). You may load RVM with the following command:
If installation and configuration were successful, RVM should now load whenever you open a new shell. This can be tested by executing the following command which should output rvm is a function as shown below.
NOTE: Before reporting problems check rvm notes as it might contain important information.
Congratulations! You have successfully installed RVM.
∞Try out your new RVM installation
Below are some examples of how to install and use a Ruby under RVM.
Display a list of all known rubies. NOTE: RVM can install many more Rubies not listed.
Install a version of Ruby (eg 2.1.1 ):
Use the newly installed Ruby:
Check this worked correctly:
Optionally, you can set a version of Ruby to use as the default for new shells. Note that this overrides the ‘system’ ruby:
∞Enjoy using RVM!
∞Where to now?
If you are new to RVM I recommend that you read the basics page. At the end of the basics page there are further links for getting started.
∞Troubleshooting Your Install
and got the notice
ca-certificates need to be installed:
If you open a new shell and running:
does not show rvm is a function , RVM isn’t being sourced correctly.
Ensure that RVM is sourced after any path settings as RVM manipulates the path. If you don’t do this, RVM may not work as expected.
If you are using GNOME on Red Hat, CentOS or Fedora, ensure that the Run command as login shell option is checked under the Title and Command tab in Profile Preferences. After changing this setting, you may need to exit your console session and start a new one before the changes take affect.
Источник
Install rvm on linux
This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.
RVM (Ruby Version Manager) is a command line tool which allows us to easily install, manage and work with multiple Ruby environments from interpreters to sets of gems.
There exists a similar application that you may also want to consider: rbenv.
Contents
Installing RVM
The install process is very easy, and is the same for any distro, including Arch Linux. You have two choices, one system-wide, another as a user. The first is for production servers, or if you are alone on your machine, you will need root privileges. The second is recommended for multiple users on the same machine (like a development test box). If you do not know which to choose then start with a single user installation.
The upstream instructions for installing RVM should just work. The install script is aware enough to tell you what packages you need to install on Arch Linux to make different rubies work. This usually involves gcc and some other stuff needed to compile ruby.
As an observation, installing RVM with gem is not recommended anymore. This article uses the recommended documentation with minor tweaks to make it work on Arch Linux.
Pre-requisites
Before starting, you will need to install the following packages base-devel , tar , gzip , diffutils , git and curl if not installed yet.
Single-user installation
/.rvm), and will not touch the standard Arch ruby package, which is in /usr.
For most purposes, the recommended installation method is single-user, which is a self-contained RVM installation in a user’s home directory.
Use the script that rvm docs recommends to install. Make sure to run this script as the user for whom you want RVM installed (i.e. your normal user that you use for development).
To check the script before running it, do:
Inspect the file, and then run it with:
Now, close out your current shell or terminal session and open a new one to set up your PATH and the rvm function. You may attempt reloading your
/.bash_profile with the following command:
However, closing out your current shell or terminal and opening a new one is the preferred way for initial installations.)
Multi-user installation
System-wide installation is a similar procedure to the single user install. However, instead run the install script with sudo. Do not run the installer directly as root!
(to install a specific version replace stable with, for example, — —version 1.13.0)
After the script has finished, add yourself and your users to the ‘rvm’ group. (The installer does not auto-add any users to the rvm group. Admins must do this.) For each one, repeat:
Group memberships are only evaluated at login time. Log the users out, then back in. You too: close out your current shell or terminal session and open a new one. (You may attempt reloading your
/.bash_profile with the following command:
However, closing out your current shell or terminal and opening a new one is the preferred way for initial installations. Alternatively, you can use the «newgrp rvm» command and check with «id» to see whether the shell has picked up the new group membership of your user)
RVM will be automatically configured for every user on the system (in opposite to the single-user installation); this is accomplished by loading /etc/profile.d/rvm.sh on login. Arch Linux defaults to parsing /etc/profile which contains the logic to load all files residing in the /etc/profile.d/ directory.
Before installing gems with multi-user rvm, make sure that /etc/gemrc does not have the line «gem: —user-install». If it does you need to comment it out otherwise the gems will install to the wrong place.
You only use the sudo command during the install process. In multi-user configurations, any operations which require sudo access must use the rvmsudo command which preserves the RVM environment and passes this on to sudo. There are very few cases where rvmsudo is required once the core install is completed, except for when updating RVM itself. There is never a reason to use sudo post-install. rvmsudo should only be needed for updating with
A cautionary action
In order to prevent the installation breakage by this cause, you may add this configuration to your /etc/sudoers file with command: su -c visudo (run as the root user)
Where ruby_interpreter would be —for example— ruby-1.9.2-p290.
Post Installation
After the installation, check everything worked with this command:
The response should be:
If you receive rvm: not found, you may need to source your
/.bash_profile (or wherever you put the line above):
Check if the rvm function is working:
Finally, see if there are any dependency requirements for your installation by running:
(Follow the returned instructions if any.)
Very important: whenever you upgrade RVM in the future, you should always run rvm notes and rvm requirements as this is usually where you will find details on any major changes and/or additional requirements to ensure your installation stays working.
Some extras
You may put in your
/.bashrc the following lines to get some useful features:
Or if you are running as a single user:
Using RVM
The RVM documentation is quite comprehensive and explanatory. However, here are some RVM usage examples to get you started.
Rubies
Installing environments
To see what Ruby environments are available to install, run:
To install one, run:
For example, to install Ruby 1.9.2 one would run the following command:
This should download, configure and install Ruby 1.9.2 in the place you installed RVM. For example, if you did a single user install, it will be in
You can define a default ruby interpreter by doing:
If not, the default environment will be the system ruby in /usr —if you have installed one using pacman— or none.
Switching environments
To switch from one environment to another simply run:
For example to switch to Ruby 1.8.7 one would run the following command:
(As you see, the flag use is not really necessary.)
You should get a message telling you the switch worked. It can be confirmed by running:
Note that this environment will only be used in the current shell. You can open another shell and select a different environment for that one in parallel.
In case you have set a default interpreter as explained above, you can do the switch with:
System ruby
If you wish the ruby interpreter that is outside RVM (i.e. the one installed in /usr by the standard Arch Linux package), you can switch to it using:
Listing environments
To see all installed Ruby environments, run the following command:
If you have installed a few rubies, this might generate a list like so:
The ASCII arrow indicates which environment is currently enabled. In this case, it is Ruby 1.8.7. This could be confirmed by running:
Gemsets
RVM has a valued feature called gemsets which enables you to store different sets of gems in compartmentalized independent ruby setups. This means that ruby, gems and irb are all separate and self-contained from the system and each other.
Creating
Gemsets must be created before being used. To create a new gemset for the current ruby, do this:
Alternatively, if you prefer the shorthand syntax offered by rvm use, employ the —create option like so:
You can also specify a default gemset for a given ruby interpreter, by doing:
Using
Tip: remove gems that reside in system prior to the RVM installation with:
and check what’s left:
To use a gemset:
You can switch to a gemset as you start to use a ruby, by appending @ to the end of the ruby selector string:
Notes
When you install a ruby environment, it comes with two gemsets out of the box, their names are default and global. You will usually find in the latter some pre-installed common gems, while the former always starts empty.
A little bit about where the default and global gemsets differ: When you do not use a gemset at all, you get the gems in the default set. If you use a specific gemset (say @testing), it will inherit gems from that ruby’s @global. The global gemset is to allow you to share gems to all your gemsets.
Within a gemset, you can utilize usual RubyGems commands
to remove gems, and
to view installed ones.
If you are deploying to a server, or you do not want to wait around for rdoc and ri to install for each gem, you can disable them for gem installs and updates. Just add these two lines to your
/.gemrc or /etc/gemrc:
Listing
To see the name of the current gemset:
To list all named gemsets for the current ruby interpreter:
To list all named gemsets for all interpreters:
Deleting
This action removes the current gemset:
By default, rvm deletes gemsets from the currently selected Ruby interpreter. To delete a gemset from a different interpreter, say 1.9.2, run your command this way:
Emptying
This action removes all gems installed in the gemset:
Updating
To upgrade to the most recent release version:
Upgrading to the latest repository source version (the most bugfixes):
Remember to use rvmsudo for multi-user setups. Update often!
Uninstalling
is going to wipe out the RVM installation —cleanly—.
Further Reading
This is just a simple introduction to switching ruby versions with RVM and managing different set of gems in different environments. There is lots more that you can do with it! For more information, consult the very comprehensive RVM documentation. This page [dead link 2021-05-17 ⓘ] is a good place to start.
Troubleshooting
Unfortunately, some ruby patchlevels just do not play nicely with Arch Linux, and many times RVM does not choose the latest patchlevel version to install. So, you will need to manually check on the ruby website, and force RVM to install it.
«data definition has no type or storage class»
This appears to be specific to 1.8.7, but if you get this error while compiling the following steps will fix your problem:
Naturally, substitute the actual build path to your source, which will be something like
Ruby 1.8.x will not compile with RVM
This is a known issue on Arch Linux, and is caused by a problem with openssl. Arch uses openssl 1.0, lower patchlevels of 1.8.7 assumes 0.9.
Certain patch levels may not build (p352 for example), p299 should work fine and can be installed using the following command:
Another approach is to install local openssl via RVM:
It may be necessary to patch 1.8.7:
Ruby 1.9.1 will not compile with RVM
Like with 1.8.x, earlier patchlevels do not like the OpenSSL 1.0. Then you can use the very same solution above, by installing openssl locally on RVM.
The patchlevels >p378 have a problem with gem paths, when $GEM_HOME is set. The problem is known and fixed in 1.9.2. (https://bugs.ruby-lang.org/issues/3584). If you really need 1.9.1 please use p378.
Ruby 2.2.2 will not compile with RVM
Like with 1.8.x and 1.9.1, earlier patchlevels do not like the OpenSSL 1.0. Then you can use the very same solution above, by installing openssl locally on RVM.
Ruby 2.3.1 will not compile with RVM
Like with 1.8.x, 1.9.1 and 2.2.2, earlier patchlevels do not like the OpenSSL 1.0. Then you can use the very same solution above, by installing openssl locally on RVM.
RVM uses wrong OpenSSL version
Ruby versions older than 2.4 require OpenSSL 1.0 but RVM will try to build them with OpenSSL 1.1. You know this is the case if you find this line in the
First install openssl-1.0 if not already installed.
You can point it to the correct version like this:
if the above does not work, try changing the last command to:
Alternatively you could also use RVM to install OpenSSL as above:
Источник