Monday, March 3, 2014

Setup Ruby On Rails environment

Step 1: Installing rbenv

Step 1.1: Setup

$ sudo apt-get update

$ sudo apt-get upgrade -y

Step 1.2: Install Required Components For Ruby and other dependencies 

$ sudo apt-get install git-core -y

$ sudo apt-get install curl -y

$ sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev libgdbm-dev ncurses-dev automake libtool bison subversion pkg-config libffi-dev

Step 1.3: Clone rbenv

$ git clone git://github.com/sstephenson/rbenv.git ~/.rbenv

$ echo ‘export PATH="$HOME/.rbenv/bin:$PATH"’ >> ~/.bashrc

$ echo ‘eval "$(rbenv init -)"’ >> ~/.bashrc

Error:
The program 'rbenv' is currently not installed. You can install it by typing:
sudo apt-get install rbenv

Solution:

$ sudo apt-get install rbenv

Step 1.4: Install some required rbenv plugins

$ cd ~/.rbenv/

$ mkdir plugins

$ cd ~/.rbenv/plugins

$ git clone git://github.com/sstephenson/ruby-build.git

Step 1.5: Restart Terminal

Error:
‘export: command not found
‘eval: command not found
‘eval: command not found
bash: /home/kirby510/.bashrc: line 134: syntax error: unexpected end of file

Solution:

$ nano /home/kirby510/.bashrc

Search for these text:
‘export PATH=/home/kirby510/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin$
‘eval ’
‘eval export PATH="/home/kirby510/.rbenv/shims:${PATH}"
and change to these text:
export PATH=/home/kirby510/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin$
eval
eval export PATH="/home/kirby510/.rbenv/shims:${PATH}"

Error:
’: command not found
bash: /home/kirby510/.bashrc: line 134: syntax error: unexpected end of file

Solution:

$ nano /home/kirby510/.bashrc

Search for these text:
}’
and change to these text:
}

Step 2: Installing Ruby

Step 2.1: Installing Ruby 1.9.3

$ rbenv install 1.9.3-p385

Error: rbenv: no such command 'install'.

Solution:

$ cd ~/.rbenv

$ cd plugins

$ cd ruby-build

$ ./install.sh

Step 2.2: Set Your Global Ruby version

$ rbenv global 1.9.3-p385

$ rbenv rehash

$ ruby -v

Step 3: Install Ruby-On-Rails Framework

$ gem install bundler

$ gem install rails -v=3.2.13

(Don't panic, installing rails will take some time.)

Return to Internship Note (LoanStreet)
Previous Episode: Install Ubuntu Desktop
Next Episode: Create Simple Rails App

0 comments:

Post a Comment