• 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 with RVM

Written by Rahul, Updated on November 10, 2020

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 – Prerequisites

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

sudo apt update 
sudo apt install curl gnupg2 

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[.9]
[ruby-]2.5[.7]
[ruby-]2.6[.5]
[ruby-]2.7[.0]
ruby-head

Step 4 - Install Ruby on Debian

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.7 

[Sample Output]

Searching for binary rubies, this might take some time.
No binary rubies available for: centos/8/x86_64/ruby-2.7.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.7.0, this may take a while depending on your cpu(s)...
ruby-2.7.0 - #downloading ruby-2.7.0, 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 14.0M  100 14.0M    0     0   107M      0 --:--:-- --:--:-- --:--:--  107M
ruby-2.7.0 - #extracting ruby-2.7.0 to /usr/local/rvm/src/ruby-2.7.0.....
ruby-2.7.0 - #configuring........................................................................
ruby-2.7.0 - #post-configuration..
ruby-2.7.0 - #compiling.....................-
.......................................................................
ruby-2.7.0 - #installing..................
ruby-2.7.0 - #making binaries executable...
Installed rubygems 3.1.2 is newer than 3.0.8 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.7.0 - #gemset created /usr/local/rvm/gems/[email protected]
ruby-2.7.0 - #importing gemset /usr/local/rvm/gemsets/global.gems................................................................
ruby-2.7.0 - #generating global wrappers.......
ruby-2.7.0 - #gemset created /usr/local/rvm/gems/ruby-2.7.0
ruby-2.7.0 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.7.0 - #generating default wrappers.......
ruby-2.7.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.7.0 - #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.7 --default  

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

Step 6 - Check Ruby Version

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

ruby --version 

ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [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 LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
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..

3 Comments

  1. Avatar micheal Reply
    November 8, 2020 at 6:53 pm

    In the first step, the second package is gnupg2!

    • Rahul Rahul Reply
      November 10, 2020 at 8:48 am

      Thanks Micheal, Article has been updated.

  2. Avatar Anthony Reply
    June 21, 2020 at 9:32 pm

    I cannot thank you enough for this. I had just purchased a Raspberry PI for Octoprint, but hadn’t yet installed the BLTouch I’d had. I found a good description on how to install the bootloader WITHOUT an Arduino, just using the RaspPi.

    It used Homebrew. Homebrew wouldn’t install without Ruby, and specifically Ruby 2.6. Inside Homebrew, they said to use rbenv/ruby-build which fought me every step of the way, refusing to install 2.6 (just stalled).

    I have been fighting with this for TWO DAYS. You’re a lifesaver!

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Ubuntu 20.04 5
  • How To Install Python 3.9 on Ubuntu 18.04 0
  • How to Use AppImage on Linux (Beginner Guide) 2
  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy