How to Set Up RVM on Debian 10 Buster

If you plan on doing any sort of Ruby development, RVM is a must. Even though Debian does have its own Ruby packages, they’re bound to Debian’s release schedules, making them an inflexible option for your projects. RVM is simple to get set up, and it allows a much greater decree of flexibility, no matter what sort of projects you’re working on.

In this tutorial you will learn:

  • How to Install cURL
  • How to Import the RVM GPG Key
  • How to Run The RVM Install
  • How to Install Ruby

RVM Ruby on Debian 10

RVM Ruby on Debian 10.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Debian 10 Buster
Software RVM, Ruby
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Install cURL

The standard RVM install procedure relies in cURL, so install it, if you don’t already have it on your system.

$ sudo apt install curl


Import the RVM GPG Key

Add RVM Key on Debian 10

Add RVM Key on Debian 10.

Next, import the RVM GPG signing key. This will ensure that the Ruby packages you get from RVM are genuine.

$ gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

How to Run The RVM Install

Install RVM on Debian 10

Install RVM on Debian 10.

Now, pull in the RVM install script, and hand it off to Bash to run. This will automatically set up RVM for your user.

$ \curl -sSL https://get.rvm.io | bash -s stable

Install Ruby

List RVM Ruby Versions on Debian 10

List RVM Ruby Versions on Debian 10.

You can now start installing Ruby version. RVM can list out what’s available for you.

$ rvm list known


RVM Install Ruby on Debian 10

RVM Install Ruby on Debian 10.

Pick a version to install, and use RVM to get it.

$ rvm install 2.6
RVM Set Ruby Version on Debian 10

RVM Set Ruby Version on Debian 10.

It will take a bit of time, since RVM needs to pull the required dependencies and build Ruby for you.

When it’s finished, tell RVM to use your new Ruby install by default.

$ rvm use 2.6 --default

You can see which version of Ruby you’re using to make sure that it worked.



$ ruby -v

Conclusion

You’re ready to start developing with Ruby. RVM can keep itself updated, and you can always pull new Ruby versions as soon as they arrive.