Hamsa K
5 min read | 3 years ago

How to Install Ruby on Rails on Ubuntu 20 04

Install Ruby on Rails on Ubuntu 20.04

Ruby is an interpreted,high-level, general-purpose programming language.Rails, is a server-side web application framework written in Ruby that allows you to use Ruby in combination with HTML,CSS and similar programming languages.

In this tutorial, we will show you how to install Ruby on Rails on Ubuntu 20.04

Also Read -> How to Install MySQL Workbench on Ubuntu 20 04

Install  using RVM

using RVM, you can install and configure multiple ruby versions on your system.

First import GPG keys of the RVM using the gpg as shown below.

gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB


root@ubuntu20:~# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 3804BB82D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: Total number processed: 1
gpg:               imported: 1

Now download the RVM installer script and install RVM

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


root@ubuntu20:~# curl -sSL https://get.rvm.io | bash -s stable --ruby
Downloading https://github.com/rvm/rvm/archive/1.29.10.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.10/1.29.10.tar.gz.asc
gpg: Signature made Wed 25 Mar 2020 09:58:42 PM UTC
gpg:                using RSA key 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski@gmail.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 7D2B AF1C F37B 13E2 069D  6956 105B D0E7 3949 9BDB
GPG verified '/usr/local/rvm/archives/rvm-1.29.10.tgz'
Upgrading the RVM installation in /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:

once installation is completed,load the RVM to the system as below.

source /usr/local/rvm/scripts/rvm

then check rvm version 

root@ubuntu20:~# rvm version
rvm 1.29.10 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

Also you can check list of all Ruby versions

rvm list known

Now we install Ruby using the rvm command.

rvm install <ruby_version>

we will install latest stable version Ruby 2.7.0 and set Ruby 2.7.1 as the default Ruby version on your system as shown below.

rvm install ruby-2.7.1
rvm --default use ruby-2.7.1

Now check ruby version

root@ubuntu20:~# ruby --version
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]

you can install rails using gem with the following command.you need to mention the version number if you want to install specific version.

gem install <rails_version>


root@ubuntu20:~# gem install rails
root@ubuntu20:~# rails --version

Now you have successfully installed Ruby on Rails on Ubuntu 20.04 system.

Also Read -> How to Install NodeJs and npm on Ubuntu 20 04

Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy