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.
Here are the packages, tools, and databases we will be installing:
- Create a GitHub account - Our preferred vendor that allows us to host git repositories in the cloud.
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.
$ sudo add-apt-repository ppa:git-core/ppa -y
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install git -y
$ 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
$ sudo apt install linuxbrew-wrapper
$ 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
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
$ brew install postgresql
$ brew install redis
$ 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.