RoR setup

From DiLab
Revision as of 23:10, 6 September 2010 by Leo (talk | contribs) (New page: {{TocRight}} Ruby, Ruby on Rails using RVM (Ruby Version Management) == For Ubuntu 10.04 == This is for Rails version 3 using Ruby version 1.9.2. === RVM === First install RVM (Ruby ver...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Ruby, Ruby on Rails using RVM (Ruby Version Management)

For Ubuntu 10.04

This is for Rails version 3 using Ruby version 1.9.2.

RVM

First install RVM (Ruby version manager)

sudo apt-get install curl git-core
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

RVM tells you to update your .bashrc. Add the following at the end of the file:

-s "$HOME/.rvm/scripts/rvm"  && source "$HOME/.rvm/scripts/rvm"

RVM is also concerned if you have any 'return' in your .bashrc script. Replace it using if and fi as in the RVM comments after its installation. Comment the first line below and add the second. Then acc fi at the end of the file.

# [ -z "$PS1" ] && return
if -n "$PS1"  ; then

Ruby

sudo apt-get install libruby1.8 zlib1g-dev libssl-dev libreadline5-dev build-essential
rvm install ruby-1.9.2
rvm use ruby-1.9.2 --default

Note, that Ruby 1.9.2 includes the ruby gems package installer.

Gems

You will likely need a database for your applications. Below is code for SQlite and Mysql, but you may have Postgress or some other options that need extra gems.

Note, no sudo for gems below.

SQLite3

sudo apt-get install sqlite3 libsqlite3-dev
gem install sqlite3-ruby

MySQL

sudo apt-get install mysql-server libmysqlclient15-dev
gem install mysql

Rails

gem install rails


Test and Done

Test your installation by making a test application

rails new tetsApp
cd testApp
rails server

Now check the http://localhost:3000 in your browser. Rail on.