(Linux) Setting up Ruby on Rails using RVM
In this post I’ll go over how to install Ruby on Rails on Linux using Ruby Version Manager, or RVM.
RVM simplifies maintaining one or more independent Ruby environments, which can be helpful for development and testing. You can run builds on multiple gemsets this way, and if you so choose you can set up self-contained environments for each project.
Express install, using default Rails environment:
Step 1: First we’ll download the keychain for verifying our download, and install curl.
Curl is an information transfer tool that supports many file transfer protocols, and we’ll use it to get the latest version of rvm.
Step 2: Now we can use curl to install RVM. For the express install I’ll assume we want the default version of rails, and add the –rails argument to install it automatically.
Step 3: Finally, let’s add a line to our .bashrc file to ensure we can access ruby, rails, rake and more from terminal.
Add “source $HOME/.rvm/scripts/rvm” to the end of your .bashrc file and save your changes.
Run “source ~/.bashrc”. You should now have access to your Ruby on Rails tools.
Custom install, using specific Ruby versions:
Step 1: As before, we’ll download the keychain for verification and install curl.
Step 2: This time we’ll set a specific Ruby version.
Step 3: As before, add “source $HOME/.rvm/scripts/rvm” to the end of your ~/.bashrc file, and run “source ~/.bashrc”.
Since we only installed Ruby and not Rails, let’s install the Rails gem ourselves.
Adding or switching between Ruby environments:
You can find additional information in the RVM documentation, linked below.
Helpful resources:
- RVM Install Guide: https://rvm.io/rubies/installing