安装Ruby on Rails技巧讲解

开发 开发工具
我们在这里为大家分步骤介绍了安装Ruby on Rails的必要准备和具体方法。希望通过本文介绍的内容能充分掌握这一安装技巧。

安装Ruby on Rails对于一个刚刚接触Ruby不久的新手来说是一个比较复杂的步骤。不过只要不断的积累经验,就会轻松的实现Ruby on Rails的安装。#t#

51CTO推荐专题:Ruby on Rails开发教程

安装Ruby on Rails***步,http://rubyforge.org/frs/download.php/33195/mongrel-1.1.4-x86-mswin32-60.gem
,下载后的文件名为:ruby186-26.exe。安装,我的目录是D:/ruby.安装好后,cmd下 d:\ruby>ruby -v显示安装的版本信息。成功。

安装Ruby on Rails第二步:http://rubyforge.org/frs/download.php/33195/mongrel-1.1.4-x86-mswin32-60.gem
下载RubyGems.(解压缩后运行“ruby setup.rb”)。
对于这一步可能有异议。有人说***步下载的已经包含RubyGems,第二步是不需要的。本人实践是需要第二步的,不代表其他人。

安装Ruby on Rails第三步:不建议直接安装,建议先下载到本地,放到ruby文件下然后安装。下载rails,本文下载的是rails2.0.2版本(下载后的文件名是:rails-2.0.2.zip),下载地址为:http://rubyforge.org/frs/download.php/33195/mongrel-1.1.4-x86-mswin32-60.gem
。放到ruby文件下后需要将压缩文件改名为rails.zip.

安装Ruby on Rails第四步:d:\ruby>gem install rails。如果报错,则执行:d:\ruby>gem clean然后d:\ruby>gem update然后继续d:\ruby>gem install rails信息如下:

D:\ruby>gem install rails
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.5
Successfully installed activerecord-2.3.5
Successfully installed rack-1.0.1
Successfully installed actionpack-2.3.5
Successfully installed actionmailer-2.3.5
Successfully installed activeresource-2.3.5
Successfully installed rails-2.3.5
8 gems installed
Installing ri documentation for rake-0.8.7...
Installing ri documentation for activesupport-2.3.5...
Installing ri documentation for activerecord-2.3.5...
Installing ri documentation for rack-1.0.1...
Installing ri documentation for actionpack-2.3.5...
Installing ri documentation for actionmailer-2.3.5...
Installing ri documentation for activeresource-2.3.5...
Installing ri documentation for rails-2.3.5...
Installing RDoc documentation for rake-0.8.7...
Installing RDoc documentation for activesupport-2.3.5...
Installing RDoc documentation for activerecord-2.3.5...
Installing RDoc documentation for rack-1.0.1...
Installing RDoc documentation for actionpack-2.3.5...
Installing RDoc documentation for actionmailer-2.3.5...
Installing RDoc documentation for activeresource-2.3.5...
Installing RDoc documentation for rails-2.3.5...

安装Ruby on Rails第五步:下载Mongrel,当前***版本为:1.1.4,下载地址为:http://rubyforge.org/frs/download.php/33195/mongrel-1.1.4-x86-mswin32-60.gem
安装mogrel还需要额外地下载gem plugin、daemons、fastthread、cgi_multipart_eof_fix,下载地址为
gen_plugin:http://rubyforge.org/frs/download.php/27044/gem_plugin-0.2.3.gem
daemons:http://rubyforge.org/frs/download.php/34222/daemons-1.0.10.gem
fastthread:http://rubyforge.org/frs/download.php/29508/fastthread-1.0.1-i386-mswin32.gem
cgi_multipart_eof_fix:http://rubyforge.org/frs/download.php/33195/mongrel-1.1.4-x86-mswin32-60.gem

安装Ruby on Rails第六步:安装mongrel。将第五步下载的文件放到ruby文件夹下,cmd执行以下语句。

gem install gem_plugin-0.2.3.gem
gem install daemons-1.0.10.gem
gem install fastthread-1.0.1-i386-mswin32.gem
gem install cgi_multipart_eof_fix-2.5.0.gem
gem install mongrel-1.1.4-x86-mswin32-60.gem

安装Ruby on Rails第七步:在D盘建立rubyPro,rubyPro下建立hello文件夹。

安装Ruby on Rails第八步:D:\rubyPro\hello>rails hello 自动建立一些相关文件,如下:

create
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create config/initializers
create config/locales

这里太多,只列出几个。

安装Ruby on Rails第九步:启动mongrel.D:\rubyPro\hello\hello>mongrel_rails start -d注意路径,如果路径错了的话,会报如下类似的错误:
!!! Path to log file not valid: log/mongrel.log
mongrel::start reported an error. Use mongrel_rails mongrel::start -h to get help.

安装Ruby on Rails第十步:好了,访问下自己电脑的port3000。显示rails的界面。到此OK。

PS:发现mongre跟weblogic的命令很多相似。比如,想停止的时候:ctrl+c,然后Y,然后回车。呵呵。

责任编辑:曹凯 来源: 百度博客
相关推荐

2009-12-14 09:33:04

Ruby安装

2009-12-18 14:19:45

Ruby on Rai

2009-12-18 13:13:59

Ruby on Rai

2009-08-27 10:21:22

Ruby on Rai

2009-12-16 17:37:31

Ruby on Rai

2009-12-16 15:41:10

Ruby on Rai

2009-12-17 17:37:42

Ruby on Rai

2009-12-16 17:07:27

Ruby on Rai

2009-12-16 15:46:41

Ruby on rai

2009-12-17 14:36:57

Ruby on Rai

2009-06-17 10:08:32

Ruby on Rai安装Ruby

2009-12-16 17:31:30

Ruby on Rai

2009-12-17 09:31:02

Ruby on Rai

2009-12-15 09:56:51

Ruby流程控制

2009-08-06 09:13:36

Ruby on Rai

2009-12-17 09:14:14

Ruby on Rai

2015-10-10 11:00:05

RubyRails性能

2009-12-16 16:37:59

Ruby on Rai

2015-10-14 17:27:18

性能

2009-12-17 14:29:50

Ruby on Rai
点赞
收藏

51CTO技术栈公众号