ruby_on_rails_3.x_装配_手记
#1 安装rvm 和 ruby
安装 rvm ,请根据官方步骤安装:https://rvm.beginrescueend.com/
安装完成以后,一定要看看rvm notes命令的输出,根据提示,按要求安装完需要的包和路径等!
下面是提示的样例:
lijg@lijg-desktop:/etc/apt$ rvm notes
Notes for Linux ( DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.04
DISTRIB_CODENAME=natty
DISTRIB_DESCRIPTION="Ubuntu 11.04" )
NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X)
This is the *original* / standard Ruby Language Interpreter
'ree' represents Ruby Enterprise Edition
'rbx' represents Rubinius
bash >= 3.2 is required
curl is required
git is required (>= 1.7 recommended)
patch is required (for ree and some ruby-head's).
If you wish to install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head),
then you must install and use rvm 1.8.7 first.
If you wish to have the 'pretty colors' again,
set 'export rvm_pretty_print_flag=1' in ~/.rvmrc.
dependencies:
# For RVM
rvm: bash curl git
# For Ruby (MRI, Rubinius, & REE) you should install the following OS dependencies:
ruby: /usr/bin/apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake
# For JRuby (if you wish to use it) you will need:
jruby: /usr/bin/apt-get install curl g++ openjdk-6-jre-headless
jruby-head: /usr/bin/apt-get install ant openjdk-6-jdk
# In addition to ruby: dependencies,
ruby-head: subversion
# For IronRuby (if you wish to use it) you will need:
ironruby: /usr/bin/apt-get install curl mono-2.0-devel
NOTE:
As of 1.8.0 RVM once again loads .rvmrc files, by default, after asking your
permission to trust it of course. If you do not wish to be enabled, simply set:
export rvm_project_rvmrc=0
Within either your /etc/rvmrc or $HOME/.rvmrc file. This will turn off the
cd/pushd hooks when sourcing the rvm() function into your shell.
Example: echo 'export rvm_project_rvmrc=0' >> $HOME/.rvmrc;
(Then close the current shell and open a new one.)
安装 ruby ,1.9.2
提示:如果没有阅读上面的要求,安装的ruby会报错的!!!需要根据下面的文档重新安装!
https://rvm.beginrescueend.com/packages/readline/
ruby1.9.2安装
rvm remove 1.9.2
rvm pkg install readline
rvm install 1.9.2 --with-readline-dir=$rvm_path/usr
Installing Ruby from source to: /home/lijg/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)...
ruby-1.9.2-p290 - #fetching
ruby-1.9.2-p290 - #extracting ruby-1.9.2-p290 to /home/lijg/.rvm/src/ruby-1.9.2-p290
ruby-1.9.2-p290 - #extracted to /home/lijg/.rvm/src/ruby-1.9.2-p290
Fetching yaml-0.1.4.tar.gz to /home/lijg/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /home/lijg/.rvm/src
Configuring yaml in /home/lijg/.rvm/src/yaml-0.1.4.
Compiling yaml in /home/lijg/.rvm/src/yaml-0.1.4.
Installing yaml to /home/lijg/.rvm/usr
ruby-1.9.2-p290 - #configuring
ruby-1.9.2-p290 - #compiling
ruby-1.9.2-p290 - #installing
Removing old Rubygems files...
Installing rubygems-1.8.10 for ruby-1.9.2-p290 ...
Installation of rubygems completed successfully.
ruby-1.9.2-p290 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
ruby-1.9.2-p290 - #importing default gemsets (/home/lijg/.rvm/gemsets/)
Install of ruby-1.9.2-p290 - #complete
安装成功后,需要运行irb看看有没有错误,提示等;如果没有,随便试几个命令看看~
#2 安装gem(好像1.9之后不用此步骤了)
1.9之后不需要了
#3 安装rails
3.1.0
gem install rails 3.1.0
... ...
测试安装成功否:
lijg@lijg-desktop:/etc/apt$ rails -v
Rails 3.1.0
其他的包也大致安装吧。
#4 创建一个helloapp
根据这里做吧,非常贴切。http://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project
#)装mysql数据库
#) 安装需要的gem包
#) 生成一个database
TODO
http://stackoverflow.com/questions/7402366/error-the-program-rails-is-currently-not-installed-creating-rails3-applica
------------------------END EOF------------------------
E
N
D
+
E
O
F
------------------------END EOF------------------------