Knowledgebase

Install Ruby with RVM on Ubuntu 18.04 and 19.10 Print

  • 0

Introduction

This tutorial explains how to install Ruby, using RVM, on Ubuntu 18.04 and Ubuntu 19.10. Ruby is a popular development language. RVM manages multiple Ruby environments and allows you to switch between them.

Requirements

  • A RCS instance running Ubuntu 18.04 or 19.10.

RVM Installation

Install GPG

$ sudo apt install gnupg

Import RVM Signing Key

Import the RVM code-signing keys. The command below is an example, please verify the keys at https://rvm.io/rvm/security.

$ gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Step 2: Download and install RVM

Go to the /tmp folder

$ cd /tmp

Download a stable version of the RVM script.

$ sudo apt-get update && apt-get install curl && curl -sSL https://get.rvm.io | bash -s stable

Add your user account to the rvm group.

$ sudo usermod -a -G rvm username

Log out of your terminal, then log back in again. Group memberships are only evaluated at login time.

Check the RVM version.

$ rvm -v

rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

Manage your Ruby Environment

Example: List the known Ruby versions

$ rvm list known

Example: Install a specific version of Ruby.

$ rvm install ruby-2.7.0

$ rvm --default use ruby-2.7.0

Example: Remove a specific version of Ruby.

$ rvm remove ruby-2.7.0

Example: Check the Ruby versions installed with RVM.

$ rvm list

Example: Check the Ruby version.

$ ruby -v

Example: Remove a specific version of Ruby.

$ rvm remove ruby-2.7.0

Uninstall RVM

  1. Remove RVM with:

    $ sudo rvm implode
    
    $ sudo rm -rf ~/.rvm
    
    $ sudo rm -rf /etc/rvmrc
    
    $ sudo rm -rf ~/.rvmrc
    
    $ sudo groupdel rvm
    
  2. Delete RVM source lines from all .bashrc, .bash_profile, .profile, and .zshrc files.

  3. Reboot

Conclusion

RVM is a simple way to manage multiple Ruby environments. For more information, see the RVM homepage.


Was this answer helpful?
Back

Powered by WHMCompleteSolution