Skip to content

HOWTO dev RVM

steveoro edited this page Jan 16, 2021 · 1 revision

HOWTO: install & configure RVM

References:

Quick install:

Follow these steps: (Substitute DESIRED_RUBY_VERSION with the Ruby version you're willing to use; i.e.: 2.3.3, 2.5, 2.6.1, ...)

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
curl -sSL https://get.rvm.io | bash -s stable

source ~/.rvm/scripts/rvm
rvm install DESIRED_RUBY_VERSION
rvm use DESIRED_RUBY_VERSION --default

ruby -v

Additional check & frequently used commands:

  1. Follow either the official installation steps to add the PGP key to the local list (on a fresh install) or install RVM with the commands above.

  2. Make sure that RVM is loaded as a function in you current shell:

$> type rvm -- | head -n 1
rvm is a function

The source command above reloads the shell configuration so that you can actually use the rvm function in your Bash console.

  • Install the Ruby version required by most of the projects (in the example, "2.3.3") with:
$> rvm install 2.3.3
  • Switch to the correct Ruby version with:
$> rvm use 2.3.3
  • Set which Ruby will be using when creating gemsets:
$> rvm use 2.3.3
  • Create a new, versioned gemset for a Project named "my_project", using the current Ruby version:
$> rvm gemset create my_project-1.00
  • List existing gemsets:
$> rvm list gemsets
  • Use a specific gemset:
$> rvm use 2.3.3@my_project-1.00

Troubleshooting your installation:

(See Troubleshooting)

Since the gem capistrano-rvm uses rvm-check via SSH to check the RVM's installation and expects RVM to be installed as a user (under a hidden .rvm/bin directory), use which rvm to see where it is actually installed and make a symlink to the root's homedir, if the expected path is missing:

  $> which rvm
  /usr/share/rvm/bin/rvm

  $> cd /root
  $> mkdir .rvm
  $> cd .rvm
  $> mkdir bin
  $> cp -s /usr/share/rvm/bin/rvm /root/.rvm/bin/rvm

Then, all Capistrano deploy commands should work as expected.

Clone this wiki locally