简体   繁体   English

如何在Ubuntu 9.04中安装.gem文件

[英]How to install .gem files in Ubuntu 9.04

I am new to rails . 我是新手。 i am trying to install gems from the source . 我正在尝试从源代码安装gem。 I AM HAVING ClothRed-0.4.1.gem file . 我有ClothRed-0.4.1.gem文件。 How can i install this gem manually . 我该如何手动安装此gem。 This .gem file had data.tar.gz and metadata.gz file .. 该.gem文件具有data.tar.gz和metadata.gz文件..

cd进入ClothRed-0.4.1.gem目录

sudo gem install ClothRed-0.4.1.gem

First off if you installed rubygems through apt I would remove it and rebuild it from source; 首先,如果您通过apt安装rubygems,我将其删除并从源代码重建它; the version that's in the 9.04 repo is pretty old. 9.04版本中的版本太旧了。

apt-get remove rubygems
wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
tar -zxvf rubygems-1.3.7.tgz
cd rubygems-1.3.7.tgz
ruby setup.rb

Now follow the steps Mike gave you and you should be ready to rock. 现在按照迈克给您的步骤进行操作,您应该已经准备就绪。

I know you say you want to install gems from source and all that fun stuff, but I would highly recommend (if you are starting out especially) to go through the following and start using rvm, as it indirectly helps you keep your gems organized. 我知道您说过您想从源代码安装所有有趣的东西,但我强烈建议您(如果您特别是刚开始的话)仔细阅读以下内容并开始使用rvm,因为它间接地帮助您使宝石保持井井有条。

$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )

and

rvm install 1.9.2 -C --with-readline-dir=/opt/local,--build=x86_64-apple-darwin10

(presuming you are setting up all your localhost etc on a MacPro) - still not met a windows RoR guy yet ;) (假设您正在MacPro上设置所有本地主机等)-仍未遇到Windows RoR家伙;)

then 然后

rvm use --create 1.9.2@rails3

for good measure you could do this: 可以采取以下措施:

$ gem install sqlite3-ruby
$ env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
$ gem install rails

then if you like 然后,如果你喜欢

rvm 1.9.2@rails3 --default

Phewww after all that, when you now install gems they are related to a ruby build.See rvm docs for more info. 毕竟,当您现在安装宝石时,它们与ruby版本有关。有关更多信息,请参阅rvm文档。

To test this has worked and you can now manage all your gems nicely: 要测试此方法是否有效,您现在可以很好地管理所有gem:

try 尝试

gem list

then 然后

rvm system

to revert to what you had 恢复到原来的状态

then 然后

rvm 1.9.2@rails3

then 然后

gem list

This is a nice way to keep your gems organized. 这是使您的宝石井井有条的好方法。

Sorry for turning this into a RVM answer, but if you use more than 1 machine rvm helps you stay sane ;) 很抱歉将其转换为RVM答案,但是如果您使用多于一台机器,rvm可以帮助您保持理智;)

PS: Saves cd'ing into dir with sudo etc etc like Mike suggested...that's not needed if you do it this way. PS:使用sudo等将cd'ing保存到dir中,如Mike建议的那样...如果您这样做,则不需要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM