• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Install Ruby on Debian Linux using RVM

Written by Rahul, Updated on July 29, 2019
Ruby debian, rails, ruby, Ruby on Rails, rvm

Ruby is a popular programming language among a large number of developers. Rails are the framework to run ruby language. Ruby language was created by Yukihiro “Matz” Matsumoto and first published in 1995. This article will help you to install ruby on rails on Debian Linux systems using RVM. RVM is the Ruby Version Manager helps for installing and managing Ruby language similar to NVM for Node.js.

Step 1 – Prerequsities

Login to your Debian system using GUI or use ssh for remote hosts. Then install some pre-required packages.

apt-get install curl gunpg2

Step 2 – Install RVM

Before installing RVM first we need to import public key in our system then use curl to install rvm in our system.

curl -sSL https://rvm.io/mpapis.asc | sudo gpg2 --import -
curl -sSL https://rvm.io/pkuczynski.asc | sudo gpg2 --import -
curl -sSL https://get.rvm.io | sudo bash -s stable

After installing RVM first we need to set up rvm environment using below command. so that current shell takes new environment settings.

source /etc/profile.d/rvm.sh

After this, install all the dependencies for installing Ruby automatically on the system. Run below command on terminal.

rvm requirements

Step 3 – List Available Ruby Versions

Get a list of available versions of Ruby language. You can install any version of your choice or requirements showing on the list.

rvm list known
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p551]
[ruby-]2.0.0[-p648]
[ruby-]2.1[.10]
[ruby-]2.2[.10]
[ruby-]2.3[.8]
[ruby-]2.4[.6]
[ruby-]2.5[.5]
[ruby-]2.6[.3]
[ruby-]2.7[.0-preview1]
ruby-head

Step 4 – Install Ruby Version

RVM is useful for installation of multiple Ruby versions on the single system. Use the following command to install required Ruby on your system. As shown below example will install Ruby 2.6 on Debian system.

rvm install 2.6

[Sample Output]

Searching for binary rubies, this might take some time.
No binary rubies available for: debian/10/x86_64/ruby-2.6.3.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for debian.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.6.3, this may take a while depending on your cpu(s)...
ruby-2.6.3 - #downloading ruby-2.6.3, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13.8M  100 13.8M    0     0  13.8M      0 --:--:-- --:--:-- --:--:-- 13.8M
ruby-2.6.3 - #extracting ruby-2.6.3 to /usr/local/rvm/src/ruby-2.6.3.....
ruby-2.6.3 - #configuring......................................................................
ruby-2.6.3 - #post-configuration..
ruby-2.6.3 - #compiling...........................................................................................
ruby-2.6.3 - #installing................
ruby-2.6.3 - #making binaries executable..
ruby-2.6.3 - #downloading rubygems-3.0.4
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  862k  100  862k    0     0  24.0M      0 --:--:-- --:--:-- --:--:-- 24.0M
ruby-2.6.3 - #extracting rubygems-3.0.4.....
ruby-2.6.3 - #removing old rubygems........
ruby-2.6.3 - #installing rubygems-3.0.4.........................................
ruby-2.6.3 - #gemset created /usr/local/rvm/gems/[email protected]
ruby-2.6.3 - #importing gemset /usr/local/rvm/gemsets/global.gems................................................................
ruby-2.6.3 - #generating global wrappers.......
ruby-2.6.3 - #gemset created /usr/local/rvm/gems/ruby-2.6.3
ruby-2.6.3 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.6.3 - #generating default wrappers.......
ruby-2.6.3 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.6.3 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri

Step 5 – Setup Default Ruby Version

Use rvm command to set up default ruby version to be used by applications. You can install multiple versions as defined in the above step. Now select which version you want to use.

rvm use 2.6.3 --default 

Using /usr/local/rvm/gems/ruby-2.6.3

Step 6 – Check Ruby Version

Using following command you can check the current ruby version is used.

ruby --version

ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

Step 7 – Install Rails

You can install the latest stable release version of Rails by running the following command. It will install Rails in global gemset So that all applications share the same version of Rails.

gem install rails
rails -v

Or we can get a specific version of Rails by defining –version during installation. Visit here to get available rails versions.

gem install rails --version=5.2.3

Congratulation’s, You have successfully installed Ruby on your system. Read our next articles to deploy Ruby with Apache or Ruby with Nginx web server with simple steps.

Share it!
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Related Posts

  • How To Install MariaDB on Debian 10 (Buster)

    October 16, 2019
  • How to Install Docker on Debian 10 (Buster)

    July 17, 2019
  • How To Upgrade Debian 9 to Debian 10 Buster

    July 7, 2019
  • How to Solve an Expired Key (EXPKEYSIG) with Apt

    February 1, 2019
  • How To Install Specific Package Version on Ubuntu & Debian

    January 1, 2019

Leave a Reply

Cancel reply

Popular Posts

  • How to Install Python 3.8 on Ubuntu, Debian and LinuxMint
  • How to Restart Network Service on CentOS 8 or RHEL 8
  • How to Check IP Address on CentOS 8
  • How to Install Java 11/8 on Amazon Linux
  • How to Configure Static IP on CentOS 8 (CLI)
Copyright © 2013-2019 TecAdmin.net. All Rights Reserved. This site uses cookies. By using this website you agree with our term and services
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkNo
Revoke cookies