WIndows 7安装Rails开发环境

Follow的参考资料是【Beginning.Rails.3】,可以在本文附件下载。


1. 安装Ruby;

2. 安装Gem;

3. 安装Rails;

4. 安装SQLite;

5. 安装MySQL。


书本中是使用SQLite,但是对于我来说的话还是MySQL用起来顺手。所以会在原文基础上安装MySQL,并会在之后的项目中以此为数据库进行配置。


我的系统是64位的Windows 7,但是安装的都是X86的软件(汗)。


OK, Let's start.


第一步,[url=http://rubyinstaller.org/downloads/]http://rubyinstaller.org/downloads/[/url]下载安装【Ruby 1.9.2-p180】。后面的安装不用我多说,验证安装结果打开CMD窗口:>ruby -v,显示结果ruby 1.9.2p180 (2011-02-18) [i386-mingw32]。


第二步,安装Gem,从这里开始进入Rails的优势之处了,通过命令安装,简单,不过请注意保持网路畅通。

>gem update --system


Updating rubygems-update

Fetching: rubygems-update-1.8.4.gem (100%)

Successfully installed rubygems-update-1.8.4

Installing RubyGems 1.8.4

RubyGems 1.8.4 installed

锘?== 1.8.4 / 2011-05-25

* 1 minor enhancement:

* Removed default_executable deprecations from Specification.

------------------------------------------------------------------------------

RubyGems installed the following executables:

E:/Ruby/Ruby192/bin/gem

RubyGems system software updated



第二条的语句的命令似乎是为了绑定gem的更新源,正常的安装这个是optional的。


>gem sources -a http://gemcutter.org

http://gemcutter.org added to sources


第三步,安装Rails,因为版本在不断更新,为了和参考书版本相适应,所以增加了版本控制参数。

>gem install rails -v 3.0


Fetching: activesupport-3.0.0.gem (100%)

Fetching: builder-2.1.2.gem (100%)

WARNING: builder-2.1.2 has an invalid nil value for @cert_chain

Fetching: i18n-0.4.2.gem (100%)

Fetching: activemodel-3.0.0.gem (100%)

Fetching: rack-1.2.3.gem (100%)

Fetching: rack-test-0.5.7.gem (100%)

Fetching: rack-mount-0.6.14.gem (100%)

Fetching: tzinfo-0.3.27.gem (100%)

Fetching: abstract-1.0.0.gem (100%)

WARNING: abstract-1.0.0 has an invalid nil value for @cert_chain # 我不知道为什么会有warning信息出现 但是不会影响安装 属于允许范围内的错误=P

Fetching: erubis-2.6.6.gem (100%)

Fetching: actionpack-3.0.0.gem (100%)

Fetching: arel-1.0.1.gem (100%)

Fetching: activerecord-3.0.0.gem (100%)

Fetching: activeresource-3.0.0.gem (100%)

Fetching: mime-types-1.16.gem (100%)

Fetching: polyglot-0.3.1.gem (100%)

Fetching: treetop-1.4.9.gem (100%)

Fetching: mail-2.2.19.gem (100%)

Fetching: actionmailer-3.0.0.gem (100%)

Fetching: thor-0.14.6.gem (100%)

Fetching: railties-3.0.0.gem (100%)

Fetching: bundler-1.0.13.gem (100%)

Fetching: rails-3.0.0.gem (100%)

Successfully installed activesupport-3.0.0

Successfully installed builder-2.1.2

Successfully installed i18n-0.4.2

Successfully installed activemodel-3.0.0

Successfully installed rack-1.2.3

Successfully installed rack-test-0.5.7

Successfully installed rack-mount-0.6.14

Successfully installed tzinfo-0.3.27

Successfully installed abstract-1.0.0

Successfully installed erubis-2.6.6

Successfully installed actionpack-3.0.0

Successfully installed arel-1.0.1

Successfully installed activerecord-3.0.0

Successfully installed activeresource-3.0.0

Successfully installed mime-types-1.16

Successfully installed polyglot-0.3.1

Successfully installed treetop-1.4.9

Successfully installed mail-2.2.19

Successfully installed actionmailer-3.0.0

Successfully installed thor-0.14.6

Successfully installed railties-3.0.0

Successfully installed bundler-1.0.13

Successfully installed rails-3.0.0

23 gems installed

Installing ri documentation for activesupport-3.0.0...

Installing ri documentation for builder-2.1.2...

Installing ri documentation for i18n-0.4.2...

Installing ri documentation for activemodel-3.0.0...

Installing ri documentation for rack-1.2.3...

Installing ri documentation for rack-test-0.5.7...

Installing ri documentation for rack-mount-0.6.14...

Installing ri documentation for tzinfo-0.3.27...

Installing ri documentation for abstract-1.0.0...

Installing ri documentation for erubis-2.6.6...

Installing ri documentation for actionpack-3.0.0...

Installing ri documentation for arel-1.0.1...

Installing ri documentation for activerecord-3.0.0...

Installing ri documentation for activeresource-3.0.0...

Installing ri documentation for mime-types-1.16...

Installing ri documentation for polyglot-0.3.1...

Installing ri documentation for treetop-1.4.9...

Installing ri documentation for mail-2.2.19...

Installing ri documentation for actionmailer-3.0.0...

Installing ri documentation for thor-0.14.6...

Installing ri documentation for railties-3.0.0...

Installing ri documentation for bundler-1.0.13...

Installing ri documentation for rails-3.0.0...

Installing RDoc documentation for activesupport-3.0.0...

Installing RDoc documentation for builder-2.1.2...

Installing RDoc documentation for i18n-0.4.2...

Installing RDoc documentation for activemodel-3.0.0...

Installing RDoc documentation for rack-1.2.3...

Installing RDoc documentation for rack-test-0.5.7...

Installing RDoc documentation for rack-mount-0.6.14...

Installing RDoc documentation for tzinfo-0.3.27...

Installing RDoc documentation for abstract-1.0.0...

Installing RDoc documentation for erubis-2.6.6...

Installing RDoc documentation for actionpack-3.0.0...

Installing RDoc documentation for arel-1.0.1...

Installing RDoc documentation for activerecord-3.0.0...

Installing RDoc documentation for activeresource-3.0.0...

Installing RDoc documentation for mime-types-1.16...

Installing RDoc documentation for polyglot-0.3.1...

Installing RDoc documentation for treetop-1.4.9...

Installing RDoc documentation for mail-2.2.19...

Installing RDoc documentation for actionmailer-3.0.0...

Installing RDoc documentation for thor-0.14.6...

Installing RDoc documentation for railties-3.0.0...

Installing RDoc documentation for bundler-1.0.13...

Installing RDoc documentation for rails-3.0.0...



第四步,安装SQLite,因为不打算用,不过本着尊重原著的精神,呆呆的follow instraction。


http://www.sqlite.org/sqlitedll-3_6_23_1.zip


http://www.sqlite.org/sqlite-3_6_23_1.zip

解压出来的三个文件:
sqlite3.exe
sqlite3.def
sqlite3.dll
放入第一步安装Ruby的bin目录下,例如C:\Ruby19\bin
然后执行命令>sqlite3 --version

验证结果3.6.23.1


安装SQLite for Ruby:

>gem install sqlite3-ruby

Fetching: sqlite3-1.3.3-x86-mingw32.gem (100%)
=============================================================================
You've installed the binary version of sqlite3.
It was built using SQLite3 version 3.7.3.
It's recommended to use the exact same version to avoid potential issues.
At the time of building this gem, the necessary DLL files where available
in the following download:
http://www.sqlite.org/sqlitedll-3_7_3.zip
You can put the sqlite3.dll available in this package in your Ruby bin
directory, for example C:\Ruby\bin
=============================================================================
Fetching: sqlite3-ruby-1.3.3.gem (100%)
#######################################################
Hello! The sqlite3-ruby gem has changed it's name to just sqlite3. Rather than
installing `sqlite3-ruby`, you should install `sqlite3`. Please update your
dependencies accordingly.
Thanks from the Ruby sqlite3 team!

#######################################################
Successfully installed sqlite3-1.3.3-x86-mingw32
Successfully installed sqlite3-ruby-1.3.3
2 gems installed
Installing ri documentation for sqlite3-1.3.3-x86-mingw32...
Installing ri documentation for sqlite3-ruby-1.3.3...
Installing RDoc documentation for sqlite3-1.3.3-x86-mingw32...
Installing RDoc documentation for sqlite3-ruby-1.3.3...


PS:使用SQLite有点小不适应,一方面是全DOS的操作页面,我没有配过工具,所以也不多说,有心得的朋友不妨介绍一番,拜谢。


第五步,安装MySQL。反正是从头开始,就到MySQL官网去下了一个最新版本,虽然说稳定的版本跟更好,自己玩玩那就尝尝鲜。=P

[url=http://www.mysql.com/downloads/mysql/]http://www.mysql.com/downloads/mysql/[/url]到这个地址下载需要的版本,本人选择mysql-5.5.12-winx64.msi

安装过程我应该不用废话吧。


接下来是编辑环境的选择,之前的RoR学习中下载过Eclipse Plugins和Aptana RadRails,但是用起来总是觉得不是那么适应,可能是因为我没有参与到实际项目开发中,所以开发IDE的好处还不是很了解,所以自己选择的是light的一个编辑器:E Editor,官网下载最新版本,无限30天trial。感谢这位仁兄的傻方法[url=http://zhujg.javaeye.com/blog/410014]http://zhujg.javaeye.com/blog/410014[/url]


以上是环境搭建完毕,具体的项目这个周末开始做起来。


最后验证下自己的环境:

ruby -v //ruby 1.9.2p180 (2011-02-18) [i386-mingw32]

gem -v //1.8.4

rails -v //Rails 3.0.0


大功告成。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值