Install ruby on rails on ubuntu

RUBY ON RAIL

Posted on 2014-12-04 06:33:33


Step 1 – Install rbenv 

 Rbenv use for manage how to install and switch version of ruby programming language. The first, you must install git then you can run command line in terminal of ubuntu system.

git clone https://github.com/sstephenson/rbenv.git ~/.rbenv echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc echo 'eval "$(rbenv init -)"' >> ~/.bashrc
 (If the second command line which alert missing rbenv, you need run command line: sudo apt-get install rbenv)
 Restart terminal then type: type rbenv

If it is function You continue to install functions

git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash

Step 2 – Install ruby The first you must install all support libraries.

apt-get install build-essential libssl-dev libcurl4-openssl-dev libreadline-dev -y

Then you can check version ruby and install the latest ruby version (example: version of ruby is 2.1.5)

rbenv install --listrbenv install 2.1.5 -k

Then you can set global usage

rbenv global 2.1.0

Step 3 – Ruby on Rails You can use “gem” for install rails framework (Gem is command of programming language ruby)

gem install rails

You can install other some libraries

sudo apt-get install sqlite3 libsqlite3-dev sudo apt-get install nodejs

Then you should create a new application with rails command, you can go to app folder and run command rails server

rails new path/to/your/new/application cd path/to/your/new/application rails server