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 [email protected] --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.