Comment on page

Ruby on Rails Development Setup for Beginners

In this blog post I will assist you in installing a Ruby on Rails development environment with a simple step-by-step process.
Today we will install Ruby on Rails (RoR) on a Debian Linux operating system (Ubuntu 18.04 LTS). With that said, RoR is compatible with other operating systems with just a few tweaks. This blog will assist you in installing RoR with a simple step-by-step process. Your installation may differ, for other operating systems refer to this site.


I am new to developing and have been using Ubuntu 18.04 LTS, a flavor of Debian Linux, for my projects. This blog will provide the steps and information needed to get the environment and dependencies installed for RoR so you can get your first project going.
Ruby on Rails is an excellent framework for web application development. For those of you who are new to RoR, like me, you will need to install several different applications (referred to as dependencies) to ensure this runs smoothly.

Tools You Will Need

Here are the packages, tools, and databases we will be installing:
  • git - A distributed version control system.
  • Create a GitHub account - Our preferred vendor that allows us to host git repositories in the cloud.
  • SSH Key - Secure Shell is a protocol that allows users to control and modify their remote servers over the Internet while ensuring security.
  • HomeBrew - Software package manager that simplifies the installation process for Mac OSX and Linux.
  • rbenv - A tool that manages, installs and runs multiple versions of Ruby.
  • Visual Studio Code - My preferred code editor.
  • Postgres - A relational database used for long term storage.
  • Redis- A key-value database used for short term storage (caching).
  • NodeJS - Javascript runtime environment. Runs on the Chrome V8 engine and executes javascript code outside of a web browser.
  • yarn - A more secure npm (node package manager - gets installed with NodeJS).

Step-By-Step Directions

Here we will be navigating through the steps to get your development environment setup and all of the dependencies installed.

Install git

You will need to run the commands below in your terminal to install git.
$ sudo add-apt-repository ppa:git-core/ppa -y
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install git -y
Remember git is the program for distributed version control, and GitHub is our preferred vendor. So if you haven’t create an account with GitHub.

Create SSH Key

You will need to create an SSH key and connect it to GitHub. We will first check to see if there are any existing SSH keys. Run this command to see if there are any pre-existing SSH keys.
$ ls -al ~/.ssh
If there are none, you will then run the next commands to generate a new one.
$ ssh-keygen -t ed25519 -C "[email protected]"
Next, press ENTER.
> Enter a file in which to save the key (/home/you/.ssh/id_ed25519): [Press enter]
Next you will be giving it your information.
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
Once you have the SSH key generated you will need to add it to the ssh-agent to manage. In the command line enter:
$ eval "$(ssh-agent -s)
> Agent pid 59566
To add it, ENTER.
$ ssh-add ~/.ssh/id_ed25519
The final step is to add it to GitHub. Follow this guide to do so.

Install HomeBrew

Homebrew is a package manager (similar to apt-get) that helps us install other packages to our system. To get the Homebrew package installed, you will have to run the below command:
$ sudo apt install linuxbrew-wrapper

Installing Ruby Environment

Install rbenv

Remember, rbenv is a tool that will help us manage installing and running multiple version of Ruby. To install rbenv, run the following:
$ brew install rbenv ruby-build
Now rbenv should be installed, but we also need to add some startup scripts to your bash profile, so that your terminal uses rbenv instead of the system wide Ruby version.
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile

Install Ruby 3.0.1

For our setup, let’s run the latest and greatest (as of this writing) version of Ruby (3.0.1). To install this version of Ruby, we will use rbenv. Run the following in your terminal:
$ rbenv install 3.0.1 -v
$ rbenv rehash
$ rbenv global 3.0.1 # set the global
$ ruby -v

Install Visual Studio Code

You can follow the directions in the Visual Studio Code link to get the correct version installed on your device.

Install Postgres

Postgres will be our relational database preference for our RoR setup. To install:
$ brew install postgresql

Install Redis

Redis is our key value database that RoR uses for caching.
$ brew install redis

Install NodeJS

The link will take you through the steps to get the correct version of NodeJS installed to your device and will give a thorough understanding.

Install Yarn

For the final step we will be installing the package manager Yarn) by running the command below.
$ brew install yarn


Now that your environment is ready, you can dive into your first project. All in all, RoR is a great development environment. It is easy to navigate, scalable, and is excellent for team projects.