windows下安装ruby on rails




1.首先去 http://rubyforge.org/frs/?group_id=167 找一个One-Click Ruby Installer下载下来
2.安装One-Click Ruby Installer的时候我是选择默认选项来安装的。
 
运行 ruby -v 显示版本号,表示安装成功。否则自行添加系统变量
 
SET RUBY_HOME=D:/ruby
SET PATH=%PATH%;%RUBY_HOME%/bin
SET RUBYOPT=rubygems
 
把以上代码复制到记事本,另存为ruby.bat 然后执行。
 
3.安装Rails:
  (1) 远程安装:
  运行 gem install rails --include-dependencies,安装Rails(需要连接网络)。
 
  (2) 本地安装:

3.2.1. Rails 需要依赖下面几个库,而且版本依赖很严格(本来想装2.0.2的,可惜有两个包不支持,没有办法,只能装1.2.6了),分别去
http://rubyforge.org/frs/?group_id=307 去下载rails (我下载的是1.2.6版本);
http://rubyforge.org/projects/activesupport 去下载activesupport(我下载的是1.4.4版本);
http://rubyforge.org/projects/activerecord/ 去下载activerecord(我下载的是1.15.6版本);
http://rubyforge.org/projects/actionpack 去下载actionpack(我下载的是1.13.6版本);
http://rubyforge.org/projects/actionmailer 去下载actionmailer(我下载的是1.3.6版本);
http://rubyforge.org/projects/aws 去下载actionwebservice(我下载的是1.2.6版本);
http://rubyforge.org/projects/rake 去下载rake(我下载的是0.8.1版本);
以上所有下载文件都包括zip和gem;

3.2.2.把第三步中下载的所有文件放到一个目录中,比如我把它放在了D:/rails中;
5.打开cmd,进入D盘
 
C:/Documents and Settings/Administrator>d:
 
D:/>cd rails
 
D:/rails>gem install activesupport-1.4.4.gem  (同等效果的D:/rails>gem install activesupport -v 1.4.4)
Successfully installed activesupport, version 1.4.4
Installing ri documentation for activesupport-1.4.4...
Installing RDoc documentation for activesupport-1.4.4...
 
D:/rails>gem install activerecord-1.15.6.gem
Successfully installed activerecord, version 1.15.6
Installing ri documentation for activerecord-1.15.6...
Installing RDoc documentation for activerecord-1.15.6...
 
D:/rails>gem install actionpack-1.13.6.gem
Successfully installed actionpack, version 1.13.6
Installing ri documentation for actionpack-1.13.6...
Installing RDoc documentation for actionpack-1.13.6..
 
D:/rails>gem install actionmailer-1.3.6.gem
Successfully installed actionmailer, version 1.3.6
Installing ri documentation for actionmailer-1.3.6...
Installing RDoc documentation for actionmailer-1.3.6...
 
D:/rails>gem install actionwebservice-1.2.6.gem
Successfully installed actionwebservice, version 1.2.6
Installing ri documentation for actionwebservice-1.2.6...
Installing RDoc documentation for actionwebservice-1.2.6...
 
D:/rails>gem install rake-0.8.1.gem
Successfully installed rake, version 0.8.1
Installing ri documentation for rake-0.8.1...
Installing RDoc documentation for rake-0.8.1...

D:/rails>gem install rails-1.2.6.gem
Successfully installed rails, version 1.2.6

到此安装过程已经结束,可以看看环境:
D:/rails>rails
Usage: D:/rails/ruby/bin/rails /path/to/your/app [options]
Options:
 
运行 rails -v 显示版本号,表示安装成功。
 
使用:
  运行 rails path/to/your/new/application 创建一个新的项目。
      create
      create  app/controllers
      create  app/helpers
      create  app/models
      create  app/views/layouts
      create  config/environments
      create  components
      create  db
      create  doc
      create  lib
      create  lib/tasks
      create  log
      create  public/images
      create  public/javascrīpts
      create  public/stylesheets
      create  scrīpt/performance
      create  scrīpt/process
      create  test/fixtures
      create  test/functional
      create  test/integration
      create  test/mocks/development
      create  test/mocks/test
      create  test/unit
      create  vendor
      create  vendor/plugins
      create  tmp/sessions
      create  tmp/sockets
      create  tmp/cache
      create  tmp/pids
      create  Rakefile
      create  README
      create  app/controllers/application.rb
      create  app/helpers/application_helper.rb
      create  test/test_helper.rb
      create  config/database.yml
      create  config/routes.rb
      create  public/.htaccess
      create  config/boot.rb
      create  config/environment.rb
      create  config/environments/production.rb
      create  config/environments/development.rb
      create  config/environments/test.rb
      create  scrīpt/about
      create  scrīpt/breakpointer
      create  scrīpt/console
      create  scrīpt/destroy
      create  scrīpt/generate
      create  scrīpt/performance/benchmarker
      create  scrīpt/performance/profiler
      create  scrīpt/process/reaper
      create  scrīpt/process/spawner
      create  scrīpt/process/inspector
      create  scrīpt/runner
      create  scrīpt/server
      create  scrīpt/plugin
      create  public/dispatch.rb
      create  public/dispatch.cgi
      create  public/dispatch.fcgi
      create  public/404.html
      create  public/500.html
      create  public/index.html
      create  public/favicon.ico
      create  public/robots.txt
      create  public/images/rails.png
      create  public/javascrīpts/prototype.js
      create  public/javascrīpts/effects.js
      create  public/javascrīpts/dragdrop.js
      create  public/javascrīpts/controls.js
      create  public/javascrīpts/application.js
      create  doc/README_FOR_APP
      create  log/server.log
      create  log/production.log
      create  log/development.log
      create  log/test.log
  运行 ruby path/to/your/new/application/scrīpt/server 启动服务。
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2008-01-17 14:45:31] INFO  WEBrick 1.3.1
[2008-01-17 14:45:31] INFO  ruby 1.8.6 (2007-09-24) [i386-mswin32]
[2008-01-17 14:45:31] INFO  WEBrick::HTTPServer#start: pid=172 port=3000

你可能感兴趣的:(windows下安装ruby on rails)