Qiang Blog

Just another zhangjingqiang's blog.

Install Ruby on Rails 3.2 on Ubuntu 12.04

Install Git

> sudo apt-get install git

Install packages

> sudo apt-get install curl g++
> sudo apt-get install zlib1g-dev libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt-dev libsqlite3-dev nodejs

Remove RVM

> rvm implode

Install rbenv

> sudo apt-get install rbenv
> echo 'eval "$(rbenv init -)"' >> ~/.bashrc

If you are using ZSH,change .bashrc to .zshrc,please.

Install ruby-build

> git clone git://github.com/sstephenson/ruby-build.git
> cd ruby-build
> sudo ./install.sh

Install ruby

(Close your terminal and start it again)

> rbenv install 1.9.3-p194
> rbenv rehash
> rbenv global 1.9.3-p194

Confirm setting

> rbenv version

Confirm ruby's path

> which ruby

Confirm ruby's version

> ruby -v

Create .gemrc file

vim ~/.gemrc

install: --no-ri --no-rdoc
update: --no-ri --no-rdoc

Install Ruby on Rails 3.2

> gem install rails -v 3.2.0
> rbenv rehash

Create work folder

> cd
> mkdir work

Create confirm application

> cd work
> rails new foo --slip-bundle
> cd foo

Install depend versions

> bundle install

Generate simple user management function

> rails g scaffold user name:string email:string
> rake db:migrate

Start application

> rails s

Confirm by browser

http://0.0.0.0:3000/users

Reference

ruby-on-rails ubuntu