Mint comes with a ruby package installed. It is installed as the root user and is not the latest version. We want the flexibility to install the latest version, to be able to easily upgrade and not have the hassles of installing gems as root.
To do this we need to use Ruby environment manager. This allows everyone on your team to be on the same version of Ruby, regardless of OS. This can be locked in with a .ruby-version
in the root directory of your project.
I recommend rbenv to do this.
The software we're installing needs a few dependencies installed in order to work.
$ sudo apt install -y build-essential libssl-dev libreadline-dev zlib1g-dev libmysqlclient-dev
Make sure you install rbenv, according to the instructions. Read carefully, there is a note for Ubuntu Linux, which pertains to Mint too, that you need to follow.
You also need to install the ruby-build plugin for rbenv.
Once rbenv is installed and verified, according to their instructions, you can install ruby.
$ rbenv install 2.4.1
This will install the current, latest version of Ruby.
It's probably a good idea to run rbenv global 2.4.1
. This will make your default ruby the latest version.
Installing Rails is pretty easy. This will install the current, lastest version.
$ gem install rails
The rails new
command is used to generate a new Rails app. The command below will generate a new app according to our needs. Replace <app-name-here>
with the name of your app. :-)
rails new <app-name-here> -d mysql --skip-test --skip-turbolinks
Next add rspec-ralls
for testing.
Using your favorite editor ;-) add the following to the :test
group of your Gemfile
(toward the bottom)
gem 'rspec-rails`
Install it as follows
$ bundle
You should be good to go!