Difference between revisions of "RoR setup"

From DiLab
Jump to: navigation, search
(RVM)
(Replacing page with '{{TocRight}} Ruby, Ruby on Rails using RVM (Ruby Version Management) * Local notes about RVM * Local notes about Rails3')
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
Ruby, Ruby on Rails using RVM (Ruby Version Management)
Ruby, Ruby on Rails using RVM (Ruby Version Management)


* Local notes about [[RVM]]
== For Ubuntu 10.04 ==
* Local notes about [[Rails3]]

This is for Rails version 3 using Ruby version 1.9.2.

=== RVM ===
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
<nowiki>bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )</nowiki>

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

<nowiki>[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"</nowiki>

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
<nowiki>if [[ -n "$PS1" ]] ; then</nowiki>

=== 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 ==

* Here is [http://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project a good first tutorial] for the current Rails.
* A few other installation tutorials:
** http://rbjl.net/19-rubybuntu-1-installing-ruby-and-rails-on-ubuntu

Latest revision as of 17:35, 28 December 2010

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

  • Local notes about RVM
  • Local notes about Rails3