Document for install ruby on rails on window and ubuntu


Posted on 2014-11-24 04:19:31

Document for Ruby on rails 

 1) Ruby

2. Rails Rails is framework which developed been for ruby programming language. 

 3. Setup ruby on rails & enviroment You should work with some jobs

1)	install apache & mysql ( use xampp )
2)	install ruby on rails – use railsinstaller.exe 
3)	Create and run the first project with rails(Default use rails with port 3000)
4)	Config project ruby on rails which use sqlite3 or mysql2 (for rails 3), or …
5)	Config  project ruby on rails which use apache server and run with port 80 for passenger.

I. Window system 

1)  Install apache & mysql Use xampp. You can download xampp at 

2) Install ruby on rails – Use railsinstaller.exe 

Download railsinstaller.exe 

 You can download at Package includes: Ruby,  devkit, rails

Then you install success, you can check

Open command line Ruby -v Check version of rails Rails -v

3) Create and run first project with rails

You can go to folder you want to create project. You can use command line cd /Users rails new project_name Folder project_name will be created at folder Users. You need cd to project then run rails server. cd project_name Then you can run command line: rails s Open browser and typing: localhost:3000 You can read more info at

4) Config project ruby on rails use sqlite3 or mysql2 (for rails 3)

1. Using sqlite3 default when you create a new project with ruby on rails. Project will use sqlite3. 
2. Using mysql2 Config /config/database.yml
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database:  my_database
  pool: 5
  username: username
  password: ‘password’
  socket: /tmp/mysql.sock
  host: localhost

3. Use scaffold to create model, view, controller

$ rails generate scaffold Post name:string title:string content:text

II) Ubuntu system 

1. Install mysql server, apache 

2, phpmyadmin

 1.1 Install mysql server

Sudo apt-get install mysql-server

1.2 Install apache

Sudo apt-get install apache2

1.3 Install phpmyadmin

Sudo apt-get install phpmyadmin

2. Install rvm (ruby version manage) Check rvm

Type rvm | head -1
Rvm is a funtion

3. Install ruby with rvm

Rvm install version_ruby
Rvm use versin_ruby –defaults
Ruby -v

4. Install rails

Gem install rails

5. Install passenger (Link rails with apache) and config project's ruby on rails run on apache with port 80

Gem install passenger 

 Rails dir structure 

Structure of rails framework include sub dir controllers, models, views, helpers...

2)	Configuration
   This folder include all file configs of system example: routes, databases, application.
3)	Db
   This folder include file the first scripts for build database
4)	Doc
   Comment for code. 	
5)	Lib
   All libraries include to project
6)	Log
   File logs of project.
7)	Public
   Include javascript, css, images.
8)	Vendor
   All libraries link from foreign system which is not supply by rails, it is supplied from Third-party provider
9)	Tmp
   All file temps of system
You can see more info from here
And more ruby on rails