RUBY | RAILS | RBENV on linix

In This Tutorial we will be setting up Rails on Linux System in my case its Cent OS 7 if you are using Ubuntu useapt-getinstead ofyum

First install all the dependencies including GIT

yum install git-core curl zlib1g-dev build-essential libssl-dev libreadli ne-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-open ssl-dev python-software-properties libffi-dev

Setting Up Ruby with Rbenv

git clone ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc exec $SHELL git clone ~/.rbenv/plugins/ruby-b uild echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bash rc exec $SHELL yum groupinstall "Development tools" rbenv install 2.3.0

In case you get some issue related to open SSl install the following dependencies

yum install -y openssl-devel readline-devel zlib-devel

Setting Up Our installed version of Rbenv as Global So that it can be set as default for every where

rbenv global 2.3.0

To confirm that the installation is done we will check the versions of our rbenv and ruby

rbenv -v
ruby -v

Congratulate yourself we have Ruby now on our system

Now we will be getting started with rails installation

Usually we don’t refer to the documentations of gem  that is installed along with it, I prefer to skip the documentation download it makes the gem installation comparetivly faster you can skip this if you want the documentation

echo 'gem: --no-document' >> ~/.gemrc

We will start installation of Bundler gem

gem install bundler

We are supposed to rehash rbenv after bundler installation so that it can set its root in our development environment

rbenv rehash

Configuring Git credentials for your git account

git config --global color.ui true
git config --global "YOUR NAME"
git config --global ''

Generating ssh key

ssh-keygen -t rsa -b 4096 -C ""

The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.

cat ~/.ssh/

Once you’ve done this, you can check and see if it worked:

ssh -T

You should get a message like this:

Hi excid3! You've successfully authenticated, but GitHub does not provide shell access.

Now we will finally install our rails Gem

gem install rails -v 4.2.6

This tutorial is for basic setup so we will be using SQLite which is default database in rails
Setting up SQLite on your system

sudo yum install sqlite-devel

Creating a rails app

rails new myapp
cd myapp/
rails s


We are done with the setup and we made a small rails app which you can see up and running on your browser  http://localhost:3000/

If you are setting up rails on a server or a Virtual Machine  insted of

rails s


bundle exec rails s -b
And on your browser hit http://IP-ADDRESS:3000/

Happy Coding………….




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s