Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

How to install Ruby and RubyGems on Ubuntu 18.04 LTS and 19.04

Today we’ll be looking at how to install Ruby and RubyGems on Ubuntu 18.04 LTS and Ubuntu 19.04.

The installation steps listed in this article will work for both versions of Ubuntu, 18.04 LTS and 19.04.

A little bit about Ruby from their website:

Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.

And RubyGems from Wikipedia:

RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems, and a server for distributing them.

Update your OS

Start off by making sure your version of Ubuntu is up to date, issue the following at the terminal to do so:

sudo apt-get update
sudo apt-get upgrade

Install Ruby and RubyGems

Now to the actual part, issue the following to install Ruby on your server:

sudo apt-get install ruby

You’ve just installed both Ruby and RubyGems. RubyGems comes bundled with Ruby on Ubuntu.

Verify the installation

To verify that both Ruby and RubyGems were successfully installed after the last command, issue the following at the terminal

#Ubuntu 18.04 LTS
theshell@ub1804:~$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

theshell@ub1804:~$ gem -v
2.7.6

#Ubuntu 19.04
theshell@ub1904:~$ ruby -v
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-gnu]
theshell@ub1904:~$ gem -v
2.7.6.2

That’s it, you’re done!