Devops Tools

Installation of Ruby on Rails on AWS EC2 Linux

In this blog we will install all dependencies/ software which are required for the Installation of Ruby on Rails application.

Installation of Ruby on Rails

  1. Install dependencies

sudo yum install -y curl gpg gcc gcc-c++ make

2. Install RVM

RVM supports most UNIX like systems and Windows (with Cygwin or Bash on Ubuntu on Windows). The basic requirements are bashcurlgpg2and overall GNU version of tools – but RVM tries to autodetect it and install anything that is needed.

Install GPG keys

Firstly we need to install mpapis public key used to verify installation package to ensure security.

sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
$ curl -sSL https://get.rvm.io | sudo bash -s stable
$ sudo usermod -a -G rvm `whoami`

On systems where sudo is configured with secure_path, the shell environment needs to be modified to set rvmsudo_secure_path=1secure_path is set on most Linux systems, but not on macOS. The following command tries to autodetect whether it is necessary to install rvmsudo_secure_path=1, and only installs the environment variable if it is the code.

if sudo grep -q secure_path /etc/sudoers; then sudo sh -c "echo export rvmsudo_secure_path=1 >> /etc/profile.d/rvm_secure_path.sh" && echo Environment variable installed; fi

Run rvm command and you will receive command not found. You have to relogin on the server

After relogin , run rvm — version

Install the latest version of Ruby

$ rvm install ruby
$ rvm --default use ruby

Ruby Installation
Ruby Installation

Check ruby version and sqlite3 version. You can use other databases as per your need

Ruby Version
Ruby Version

Install Bundler

Bundler is a popular tool for managing application gem dependencies. We will use Bundler in this tutorial, so let us install it:

gem install bundler --no-rdoc --no-ri
Bundle Installation

Install Node.js

If you are using Rails, then you must install Node.js. This is because Rails’s asset pipeline compiler requires a Javascript runtime.

curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum install -y nodejs

Install Rails

Before you install Rails, you should check to make sure that your system has the proper prerequisites installed. These include Ruby and SQLite3.

$ gem install rails
$ rails --version
Rail Version
Rail Version

Finally congratulations!! You have successfully followed each and every step for Installation of Ruby on Rails. All dependencies which are required for Ruby on Rails application is successfully installed.

References:

Please follow and like us: