Installing Rails with RVM on Ubuntu 20.xx


Ok, let’s make sure the essentials are installed:

sudo apt-get install -y autoconf bison build-essential curl g++ gcc git libffi-dev libgconf-2-4 libgdbm-dev libncurses5-dev libreadline-dev libsqlite3-dev libssl-dev libxi6 libyaml-dev make sqlite3 xvfb zip zlib1g-dev nodejs gnupg2 vim libgmp-dev


Now we need to install Yarn:

curl -sS | sudo apt-key add -

echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

sudo apt update && sudo apt install -y yarn


Time to install RVM, but first we need to get a key. Occasionally this key changes, so check here for the latest if there’s an issue:

gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Awesome, now we can push on and grab RVM.

curl -L | bash -s stable

Once RVM is installed we need to modify our .bashrc file which is located in the home folder. I’m using vim here:

vim ~/.bashrc

Add this to the end of the .bashrc file you are currently editing:

source $HOME/.rvm/scripts/rvm 

Exit the editor, exit your terminal.

Reopen a terminal and enter the following command – if you see password required just enter your password and hit return.

rvm requirements --autolibs=enable


We are ready to install ruby. Head over to the official site to find the latest version of Ruby, as of this writing it is 2.7.2 so let’s install that:

rvm install 2.7.2

Instruct RVM to use 2.7.2 and set it as the default version of Ruby:

rvm use --default 2.7.2

If you type ruby -v you should see 2.7.2


Great, let’s grab Rails. Visit the official site to find the latest version, as of this writing it is

gem install rails --version= --no-document

Whilst we are at it, if you are using MySQL, install the MySQL2 gem:

sudo apt install libmysqlclient-dev

gem install mysql2 --no-document

Type rails -v and you should see

Install Google Chrome

If you haven’t installed Chrome, let’s do that now:

wget -q -O - | sudo apt-key add -

sudo sh -c 'echo "deb [arch=amd64] stable main" >> /etc/apt/sources.list.d/google.list'

sudo apt-get update

sudo apt-get install google-chrome-stable

sudo rm /etc/apt/sources.list.d/google.list*

Install Chrome Driver

Finally we will need Chrome Driver.



sudo mv chromedriver /usr/bin/chromedriver

sudo chown root:root /usr/bin/chromedriver

sudo chmod +x /usr/bin/chromedriver

sudo rm 

That’s it, Rails is up and ready to go!

Happy Hacking 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s