通过gem安装rails

本文介绍了使用gem安装rails的便捷方法,输入命令后,gem会先在本地找安装包,没有则自动下载,还可通过参数默认安装依赖包。同时提到安装中可能遇到的问题,如rubyforge服务异常导致安装失败,有时问题会自动恢复。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

有了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.4dot.gif
Installing RDoc documentation 
for activesupport-1.0.4dot.gif
Installing RDoc documentation 
for activerecord-1.10.1dot.gif
Installing RDoc documentation 
for actionpack-1.8.1dot.gif
Installing RDoc documentation 
for actionmailer-0.9.1dot.gif
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



需要注意的是rubyforge有时候会因为维护暂停服务或者服务不正常,我遇到过有一次死活都安装不了rails
而跑去安装Rails Log Analyzer, 另外一次遇到gem一执行就退出, 从错误上看似乎是远程的服务器有错误
开始我还以为是gem坏了,重新安装了好几次, 结果第二天就自动好了

转载于:https://www.cnblogs.com/baoz/archive/2005/07/20/2269896.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值