While there are packages for ruby and many of its gems in the major Linux distro repositories, as with nodejs may developers will find that a local install of the language that runs out of their home directory will be the easiest to manage, especially if they have to work with multiple versions.
The two different (and incompatible with each other) version managers for ruby are rvm and rbenv. A short article promoting rbenv over rvm by the rbenv developers can be found here. The other side is represented in the majority of comments on this discussion thread. I have run rvm in the past and found it fairly easy to set up and use in a Linux environment. Both appear to be fairly active projects that will serve the needs of most developers.
This note focuses on the somewhat involved process of getting rbenv up and running on Linux from source. I was "inspired" to do this because it was a prerequisite for compiling the latest version of the free second edition of Pro Git, which possibly has the worst documented build instructions ever written (at least for someone who only had superficial knowledge of the ruby ecosystem before). Go figure.
First, ignore everything that mentions MacOS and homebrew. You'll be a better person for it.
Clone the git repo for rbenv into ~/.rbenv:
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
Add ~/.rbenv/bin to your path. For most Linux distros, this can be done in .bash_profile. On Ubuntu the developers recommend .bashrc:
export PATH="$HOME/.rbenv/bin:$PATH
Init rbenv in your shell by adding this to .bashrc:
eval "$(rbenv init -)"
You'll need to logout and then in again to effect these changes.
If you want to do anything useful with rbenv, including installing ruby itself, you need to install ruby-build. It's hard to understand why anyone would label this an "Optional" step.
Install it as an rbenv plugin:
$ mkdir ~/.rbenv/plugins
$ git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
Go back to the doc for rbenv proper and follow the instructions on using rbenv-doctor to verify everything has been properly setup.
List versions of ruby available:
$ rbenv install --list
Install ruby 2.5.1:
$ rbenv install 2.5.1
Set what you just installed to be your ruby version in the shell:
$ rbenv shell 2.5.1
Make sure ruby is there:
$ ruby --version
$ which ruby