generalruby

Get started with RVM

NOTE: We are in the process of modifying the file structure and configuration for many Bitnami stacks. On account of these changes, the file paths stated in this guide may change depending on whether your Bitnami stack uses native Linux system packages (Approach A), or if it is a self-contained installation (Approach B). To identify your Bitnami installation type and what approach to follow, run the command below:

 $ test ! -f "/opt/bitnami/common/bin/openssl" && echo "Approach A: Using system packages." || echo "Approach B: Self-contained installation."

The output of the command indicates which approach (A or B) is used by the installation, and will allow you to identify the paths, configuration and commands to use in this guide. Refer to the FAQ for more information on these changes.

Approach A: Bitnami installations using system packages

Bitnami installations using system packages don’t include RVM, but rbenv. Refer to this guide for usage instructions.

Approach B: Self-contained Bitnami installations

RVM (Ruby enVironment Manager) is a command-line tool which allows you to easily install, manage, and work with multiple Ruby environments from interpreters to sets of gems.

Every installed Ruby using RVM is isolated in its own directory with its libraries and gems. This is convenient if you need to maintain multiple projects, dependent on different Ruby versions.

RVM also has a very flexible gem management system called “named gemsets”. These gemsets allows defining independent groups of gems, which is really convenient to maintain multiple projects with different set of gems. This is partially addressed by Bundler, but while Bundler just takes care of installing and selecting the appropriate Gem version, RVM completely isolate the gem sets into its own GEM_PATH. Also, not all your applications will be compatible with Bundler. It is also possible to use a combination of both, which will make sure you won’t get in any trouble when working with different gem requirements.

Because of the above mentioned features, RVM is a perfect asset for your development process but that does not mean it is not suitable for production environments thanks to its ability to make setting up rubies / gems very efficient. It will also allow you to test your application in multiple Ruby versions so you will have a consistent environment from development, through testing, and into production.

Prerequisites

To make use of RVM, you must have a compilation environment set up in your machine. You will need this compilation environment mostly to compile new Ruby versions but it will be also needed to compile some gems such as nokogiri.

Find a detailed list of the packages to install by executing:

$ rvm requirements

This will include more packages than really necessary as the Bitnami Ruby Stack already includes most of the required libraries.

Execute the command below to install the minimum list of required packages:

  • Debian:

    $ sudo apt-get install build-essential autoconf automake libtool bison
    
  • CentOS:

    $ sudo yum groups mark install "Development Tools"
    
Last modification July 29, 2020