锁定老帖子 主题:WIndows 7安装Rails开发环境
该帖已经被评为新手帖
|
|
---|---|
作者 | 正文 |
发表时间:2011-05-27
最后修改:2011-06-02
1. 安装Ruby; 2. 安装Gem; 3. 安装Rails; 4. 安装SQLite; 5. 安装MySQL。 书本中是使用SQLite,但是对于我来说的话还是MySQL用起来顺手。所以会在原文基础上安装MySQL,并会在之后的项目中以此为数据库进行配置。 我的系统是64位的Windows 7,但是安装的都是X86的软件(汗)。 OK, Let's start. 第一步,http://rubyinstaller.org/downloads/下载安装【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 http://www.mysql.com/downloads/mysql/到这个地址下载需要的版本,本人选择mysql-5.5.12-winx64.msi 安装过程我应该不用废话吧。 接下来是编辑环境的选择,之前的RoR学习中下载过Eclipse Plugins和Aptana RadRails,但是用起来总是觉得不是那么适应,可能是因为我没有参与到实际项目开发中,所以开发IDE的好处还不是很了解,所以自己选择的是light的一个编辑器:E Editor,官网下载最新版本,无限30天trial。感谢这位仁兄的傻方法http://zhujg.javaeye.com/blog/410014 以上是环境搭建完毕,具体的项目这个周末开始做起来。 最后验证下自己的环境: ruby -v //ruby 1.9.2p180 (2011-02-18) [i386-mingw32] gem -v //1.8.4 rails -v //Rails 3.0.0 大功告成。 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2011-05-27
眼花
编辑器有code标签,带代码高亮,编辑一下吧 |
|
返回顶楼 | |
发表时间:2011-05-27
这点东西有什么值得写的?
|
|
返回顶楼 | |
发表时间:2011-05-27
这个,我觉得吧,在win上搞ruby真的不好。。。。真的不要再有类似的文章了,不过楼主真认真。
|
|
返回顶楼 | |
发表时间:2011-05-27
chloerei 写道 眼花 编辑器有code标签,带代码高亮,编辑一下吧 恩 是我自己画蛇添足了 待会编辑一下 谢谢 |
|
返回顶楼 | |
发表时间:2011-05-27
ray_linn 写道 这点东西有什么值得写的? 自己的记录 倒是献丑了=P |
|
返回顶楼 | |
发表时间:2011-05-27
jinleileiking 写道 这个,我觉得吧,在win上搞ruby真的不好。。。。真的不要再有类似的文章了,不过楼主真认真。 应该是在Linux上做么?自己电脑就是windows的 所以就自然这么部署了 平台的要求很高么? |
|
返回顶楼 | |
发表时间:2011-05-27
这是开发环境吧,我以为是部署上线的。
|
|
返回顶楼 | |
发表时间:2011-05-27
chaostan 写道 jinleileiking 写道 这个,我觉得吧,在win上搞ruby真的不好。。。。真的不要再有类似的文章了,不过楼主真认真。
应该是在Linux上做么?自己电脑就是windows的 所以就自然这么部署了 平台的要求很高么? 你现在还只是处于让rails跑起来而已,真正开发时,不少gem会把你玩残的。还是老老实实的用virtualBox装个ubuntu来上RoR吧。简单方便。 |
|
返回顶楼 | |
发表时间:2011-05-28
Windows下的安装很简单,部署还比较麻烦
在Windows下学习安装最简单的就是直接用Engine Yard维护的railsinstaller(http://railsinstaller.org/),想用ruby1.9.2就用rubyinstaller(http://rubyinstaller.org)再安装其它gems即可,只要网络流畅,devkit安装设置好了,一般gem安装过程会很流畅,想让ruby1.9.2效率高一点,可以打上rubyinstaller邮件列表中的与win32有关的补丁,哪个gem装不上了也可以到邮件列表中发问。 |
|
返回顶楼 | |