Installation of Ruby on Rails on AWS EC2 Linux

Please visit my website and subscribe to my youtube channel for more articles

https://devops4solutions.com/

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

Rails Installation on Linux

sudo yum install -y curl gpg gcc gcc-c++ make
Image for post
Image for post

2. Install RVM

RVM supports most UNIX like systems and Windows (with Cygwin or Bash on Ubuntu on Windows). The basic requirements are bash, curl, gpg2 and 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`
Image for post
Image for post
Image for post
Image for post

On systems where sudo is configured with secure_path, the shell environment needs to be modified to set rvmsudo_secure_path=1. secure_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
Image for post
Image for post

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

Image for post
Image for post

After relogin , run rvm — version

Image for post
Image for post

Install the latest version of Ruby

$ rvm install ruby
$ rvm --default use ruby
Image for post
Image for post
Ruby Installation

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

Image for post
Image for post
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
Image for post
Image for post
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
Image for post
Image for post
Rails 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:

Written by

Devops Automation Enginneer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store