有了gem,安装rails变得异常简单了
输入gem install rails就开始安装,gem会先在本地找安装包,如果没有,就会自动去下载,非常方便
它一个一个会询问你是否安装相关的依赖包,如果不想每次都输入Y来确认,可以通过参数--include-dependencies
来默认安装所有的依赖包
root@xxxx rubywork]# gem install rails --include-dependencies
Attempting local installation of 'rails'
Local gem file not found: rails*.gem
Attempting remote installation of 'rails'
Updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-0.12.1
Successfully installed rake-0.5.4
Successfully installed activesupport-1.0.4
Successfully installed activerecord-1.10.1
Successfully installed actionpack-1.8.1
Successfully installed actionmailer-0.9.1
Successfully installed actionwebservice-0.7.1
Installing RDoc documentation for rake-0.5.4
Installing RDoc documentation for activesupport-1.0.4
Installing RDoc documentation for activerecord-1.10.1
Installing RDoc documentation for actionpack-1.8.1
Installing RDoc documentation for actionmailer-0.9.1
Installing RDoc documentation for actionwebservice-0.7.1
Attempting local installation of 'rails'
Local gem file not found: rails*.gem
Attempting remote installation of 'rails'
Updating Gem source index for: http://gems.rubyforge.org
Successfully installed rails-0.12.1
Successfully installed rake-0.5.4
Successfully installed activesupport-1.0.4
Successfully installed activerecord-1.10.1
Successfully installed actionpack-1.8.1
Successfully installed actionmailer-0.9.1
Successfully installed actionwebservice-0.7.1
Installing RDoc documentation for rake-0.5.4

Installing RDoc documentation for activesupport-1.0.4

Installing RDoc documentation for activerecord-1.10.1

Installing RDoc documentation for actionpack-1.8.1

Installing RDoc documentation for actionmailer-0.9.1

Installing RDoc documentation for actionwebservice-0.7.1
安装完成以后可以通过gem list --local
来查看已经安装了哪些包
[root@xxx rubywork]# gem list --local
*** LOCAL GEMS ***
actionmailer (0.9.1)
Service layer for easy email delivery and testing.
actionpack (1.8.1)
Web-flow and rendering framework putting the VC in MVC.
actionwebservice (0.7.1)
Web service support for Action Pack.
activerecord (1.10.1)
Implements the ActiveRecord pattern for ORM.
activesupport (1.0.4)
Support and utility classes used by the Rails framework.
rails (0.12.1)
Web-application framework with template engine, control-flow layer,
and ORM.
rake (0.5.4)
Ruby based make-like utility.
sources (0.0.1)
This package provides download sources for remote gem installation
*** LOCAL GEMS ***
actionmailer (0.9.1)
Service layer for easy email delivery and testing.
actionpack (1.8.1)
Web-flow and rendering framework putting the VC in MVC.
actionwebservice (0.7.1)
Web service support for Action Pack.
activerecord (1.10.1)
Implements the ActiveRecord pattern for ORM.
activesupport (1.0.4)
Support and utility classes used by the Rails framework.
rails (0.12.1)
Web-application framework with template engine, control-flow layer,
and ORM.
rake (0.5.4)
Ruby based make-like utility.
sources (0.0.1)
This package provides download sources for remote gem installation
需要注意的是rubyforge有时候会因为维护暂停服务或者服务不正常,我遇到过有一次死活都安装不了rails
而跑去安装Rails Log Analyzer, 另外一次遇到gem一执行就退出, 从错误上看似乎是远程的服务器有错误
开始我还以为是gem坏了,重新安装了好几次, 结果第二天就自动好了