I am trying to Install RVM but facing error. I am using following code to install RVM

sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm install 2.3.1
rvm use 2.3.1 --default
ruby -v

I want to Install Ruby on Rail. Is there any other method to do this so please also share.


Prepare Your System

Update your package manager first:

sudo apt-get update

Ensure Curl is installed:

sudo apt-get install curl

Install RVM

If you have an older version of Ruby installed on your computer, there’s no need to remove it. RVM will leave your “system Ruby” untouched and use your shell to intercept any calls to Ruby. Any older Ruby versions will remain on your system and the RVM version will take precedence.

The RVM website explains how to install RVM. Here’s the simplest way:

\curl -L https://get.rvm.io | bash -s stable --ruby

Install Node.js

Since Rails 3.1, a JavaScript runtime has been needed for development on Ubuntu Linux. The JavaScript runtime is required to compile code for the Rails asset pipeline. For development on Ubuntu Linux it is best to install the Node.js server-side JavaScript environment.

sudo apt-get install nodejs

Check the Gem Manager

RubyGems is the gem manager in Ruby. Check the installed gem manager version:

gem -v

You may see: 2.3.1

Use this to upgrade the Ruby gem manager:

gem update --system

Ruby on Rails Installation

Many developers prefer to keep the global gemset sparse and install Rails into project-specific gemsets, so each project has the appropriate version of Rails.

If you install Rails at this point, you will install it into the global gemset.

Instead, make a gemset just for the current stable release:

rvm use ruby-2.3.1@rails5.0 --create

Now you can install the most recent stable release:

gem install rails
rails -v

And now you should have rails installed! I got these instructions from this RailsApps page. They go on to offer advice on setting up a Rails project directory and more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.