|The instructions provided in this article or section are considered advanced.|
You are expected to be knowledgeable in the UNIX shell.
Ruby Version Manager (RVM) is a utility that allows you to add your own personal version of Ruby to a user. It allows you to add, remove, or have multiple versions of Ruby and its libraries live in your user directory.
This article walks you through how to manually install RVM as well as a custom version of Ruby and/or Rails. Once complete, you can then enable Passenger within your panel and select which version of Ruby you wish to use with your site.
To get started, you'll first need to install RVM under your shell user and set it up to load automatically. Visit the Enabling Shell Access article to make sure your user is a Shell user. Then you can log in to your server via SSH to run the following commands in your users directory.
- Install RVM's public keys:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
This creates a new folder under your user named /.gnupg with the public key.
- Install the latest stable version of RVM:
curl -sSL https://get.rvm.io | bash -s stable
This command does the following three things:
- Creates a new folder under your user named /.rvm
- Adds this line to your .bash_profile
- [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
- Adds this line to your .bashrc file:
- export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
- Run this to unset your GEM_HOME:
- Run this to source your new RVM install:
- Add this to your .bashrc file
- Run this command to update your .bash_profile:
- Now check if RVM is installed and functioning:
rvm --version rvm 1.26.11 (latest) by Wayne E. Seguin <firstname.lastname@example.org>, Michal Papis <email@example.com> [https://rvm.io/]
Installing any version of Ruby you wish
Once RVM is configured, you can install any version of Ruby you like.
You must first disable autolibs. If autolibs is not disabled, the Ruby installation fails due to permission issues. Run the following to disable autolibs:
rvm autolibs disable
Run the following to get a list of available versions to install:
rvm list known
Install the exact version of Ruby you require. This example installs version 2.2.2:
rvm install 2.2.2
You can now tell your system to use this version by default:
rvm use 2.2.2 --default
Check the version of Ruby to confirm it's been updated.
ruby -v ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
Installing any version of Rails you wish
You must first disable autolibs. If autolibs is not disabled, the Rails installation fails due to permission issues. Run the following to disable autolibs:
rvm autolibs disable
Run this command to install the latest version of Rails:
gem install rails
Or you can install a specific version:
gem install rails --version 4.2.1
View a full list of available versions at rubygems.org:
Enabling RVM using the DreamHost panel
You can now visit the How to Enable RVM article to specify the version of Ruby you installed above for any specific domain running Passenger.