- Published on
Ruby on Rails Development Setup for Beginners
- Ryan Hasinsky
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).
- yarn - A more secure npm (node package manager - gets installed with NodeJS).
Here we will be navigating through the steps to get your development environment setup and all of the dependencies installed.
You will need to run the commands below in your terminal to install git.
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.
If there are none, you will then run the next commands to generate a new one.
Next, press ENTER.
Next you will be giving it your information.
Once you have the SSH key generated you will need to add it to the ssh-agent to manage. In the command line enter:
To add it, ENTER.
The final step is to add it to GitHub. Follow this guide to do so.
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:
Installing Ruby Environment
Remember, rbenv is a tool that will help us manage installing and running multiple version of Ruby. To install rbenv, run the following:
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.
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:
Install Visual Studio Code
You can follow the directions in the Visual Studio Code link to get the correct version installed on your device.
Postgres will be our relational database preference for our RoR setup. To install:
Redis is our key value database that RoR uses for caching.
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.
For the final step we will be installing the package manager Yarn) by running the command below.
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.