Setup Ruby On Rails on Ubuntu


Installation of Ruby on Rails for Production server is pretty straight forward. Below are the relevant steps.

1.INSTALL THE NEEDED LIBRARIES

sudo apt-get install zlib1g zlib1g-dev build-essential openssl libssl-dev libmysqlclient18 libmysqlclient-dev libyaml-dev

2.DOWNLOAD AND INSTALL RUBY 1.9.3

sudo apt-get update
 sudo apt-get install ruby1.9.3

Note you can install latest Ruby too.

3.INSTALL RAILS

 sudo apt-get install ruby-dev
 sudo apt-get install build-essential g++
 sudo gem install railsconfigure rails application with nginx and unicorn

4.INSTALL SQLITE ADAPTER

 sudo apt-get install libsqlite3-dev

If you passed all above steps without any ERROR, Now it’s time to create a rails demo application OR SCP existing one and test it out.

Below is the steps to create new rails application

 rails new demo
 cd demo
 uncomment therubyracer gem in Gemfile
 sudo apt-get install build-essential g++
 bundle install
 rails g scaffold order name:string
 rake db:create
 rake db:migrate

Open config/routes file and uncomment root ‘welcome/index’ and replaced with ‘orders/index’

$rm -rf public/index

That’s all, Now run your Rails application.

Advertisements

3 thoughts on “Setup Ruby On Rails on Ubuntu

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s