Difference between revisions of "RoR setup"

From DiLab
Jump to: navigation, search
(Test and Done)
(RVM)
Line 7: Line 7:


=== RVM ===
=== RVM ===
First install RVM (Ruby version manager). This will download the source and compile the necessary tools, and will also allow to switch between different versions, for example, ruby-1.8 and ruby-1.9.2.
First install [http://rvm.beginrescueend.com/ RVM (Ruby version manager)]. This will download the source and compile the necessary tools, and will also allow to switch between different versions, for example, ruby-1.8 and ruby-1.9.2.


sudo apt-get install curl git-core
sudo apt-get install curl git-core

Revision as of 13:22, 10 November 2010

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). This will download the source and compile the necessary tools, and will also allow to switch between different versions, for example, ruby-1.8 and ruby-1.9.2.

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.

Links