Ubuntu noob rails安装在zlib上失败。

时间:2021-06-22 07:16:55

I've just moved over to Ubuntu 8.10 as my dev box; it's my first serious foray into Linux as a daily-use OS, and I'm having a hard time getting Rails going. I have followed a number of tutorials which all seem to work fine, but when I try and use gem install or gem update on anything, I get an error that looks like this:

我刚刚转移到Ubuntu 8.10作为我的开发盒;这是我第一次以日常使用操作系统的方式进入Linux系统,我很难让Rails运行起来。我已经学习了一些教程,这些教程看起来都很好,但是当我尝试使用gem安装或gem更新时,我就会得到这样一个错误:

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- zlib (LoadError)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:1
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:5
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:167:in `load_and_instantiate'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:88:in `[]'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:144:in `find_command'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:131:in `process_args'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:102:in `run'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run'
from /usr/local/bin/gem:21

I have (as recommended in the tutorials) installed zlib, zlib1g, and zlib1g-dev. I've even found a few tutorials on this particular problem (all for flavors other than mine, however) but they didn't help.

我已经(在教程中推荐)安装了zlib、zlib1g和zlib1g-dev。我甚至在这个特别的问题上找到了一些教程(不过除了我的以外,所有的都是关于味道的),但是他们没有提供帮助。

I'm on Ubuntu 8.10, ruby version 1.8.8dev gem version 1.3.2

我在Ubuntu 8.10, ruby版本1.8.8dev gem版本1.3.2。

I've tried reinstalling ruby and gems each and separately, to no avail.

我尝试过重新安装ruby和gems,但没有成功。

13 个解决方案

#1


297  

If you come across this question trying to install Ruby using Ruby Version Manager (RVM) on Ubuntu 10.04 then there are instructions on installing zlib on the rvm web site http://rvm.beginrescueend.com/packages/zlib/

如果您遇到这个问题,试图在ubuntu10.04上使用Ruby版本管理器(RVM)安装Ruby,那么在RVM web站点上安装zlib会有一些说明,http://rvm.begineend.com/packages/zlib/。

The steps are:

的步骤是:

rvm pkg install zlib

(or rvm package install zlib if you get "ERROR: Unrecognized command line argument: 'pkg'" - older versions of rvm used the verb 'package' instead)

(或rvm包安装zlib,如果您得到“错误:未识别的命令行参数:‘pkg’”——rvm的老版本使用的是“包”)

then

然后

rvm remove 1.9.1
rvm install 1.9.1

#2


52  

I am using Ubuntu 10.04 (Lucid), i wanted to install ruby 1.9.2 because 1.9.1 is not recommended with Rails. So I downloaded the source for 1.9.2 and unzipped/unarchived it. my source distro is ruby-1.9.2-p0. After I unpacked it, I built zlib as follows:

我使用Ubuntu 10.04 (Lucid),我想安装ruby 1.9.2,因为不推荐使用Rails 1.9.1。因此,我下载了1.9.2的源代码,并将其解压缩/未归档。我的源代码发行版是ruby-1.9.2-p0。在打开它之后,我构建了zlib:

cd ruby-1.9.2-p0/ext/zlib
ruby extconf.rb
make
sudo make install
sudo gem install rails

that fixed the problem. This is similar to what other people posted above, but not exactly, so I figured I may as well post exactly what I did to get it going.

固定的问题。这和上面提到的人很相似,但不完全一样,所以我想我可以把我做的事情准确地贴出来。

#3


22  

I have the same problem in CentOS and fix it by executing the following command:

我在CentOS有同样的问题,并通过执行以下命令来修复它:

First, I ensure that zlib and zlib-devel exist (like many suggested above).

首先,我确保zlib和zlib-devel(像上面提到的许多)一样存在。

yum install zlib zlib-devel

Second, I recompiled and installed the sources of zlib that comes with ruby.

其次,我重新编译并安装了带有ruby的zlib源。

cd /home/myname/installers/ruby-1.8.7-p174/ext/zlib/
ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
make
make install

That commands seem to fix the problem, then I execute gem update --system and the error with zlib vanished. Then I install rails with gem install rails. Note to mention I had installed gem before, and after recompile and install zlib, I don't recompile neither install gem (actually I don't knew how uninstall it because I don't found a script to do that)

这些命令似乎解决了问题,然后我执行gem更新——系统和zlib的错误消失了。然后我用gem安装rails安装rails。注意,我之前已经安装了gem,在重新编译和安装zlib之后,我不会重新编译也不会安装gem(实际上我不知道如何卸载它,因为我没有找到这样做的脚本)

That works for me...hope to you to.

适合我…希望你来。

Regards.

的问候。

#4


12  

try

试一试

aptitude install zlib1g-dev

Then go about your business.

那就去做你的事吧。

#5


8  

I really didn't like any of these answers ... none really focused on the users actual needs and question ... just people telling what they did ... no context and it didn't even work for me ...

我真的不喜欢这些答案……没有人真正关注用户的实际需求和问题……只是人们告诉他们他们做了什么…没有背景,甚至对我都不起作用……

So, ..

所以,. .

I'm installing a new box Ubuntu 8.04 LTS 64-bit ...

我正在安装一个新的box Ubuntu 8.04 LTS 64位…

So, I ...

所以,我……

cd ~  
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz  
tar -xvvf ruby-1.9.2-p180.tar.gz  
cd ruby-*  
./configure  
make  
install  
sudo make install  

And then I have this problem with ...

然后我有这个问题。

gem list

it doesn't work ... something about zLib not found crap ...

它不工作…一些关于zLib的东西没有发现垃圾……

So, I actually READ the README and find that I need to edit a file ...

所以,我实际上读了README并发现我需要编辑一个文件…

[my ruby source directory]/ext/Setup

and UN-COMMENT the line with zLib in it ... by removing the "#" in the first column

然后取消注释与zLib的连线。通过删除第一列中的“#”。

Then I run the commands again ... included here for reference ...

然后我再次运行命令…包括在这里供参考…

./configure
make  
install  
sudo make install  

and all is well ... it's logical ... and is devoid of "rvm" and other ... "just install more stuff to make it work" type solutions.

而且一切都很好……它的逻辑…并且缺乏“rvm”和其他…“安装更多的东西,让它工作”类型解决方案。

Joet

Joet

#6


7  

Just goto Ruby Source Package , Unzip it.

只需goto Ruby源代码包,解压它。

Goto /your-ruby-dir/ext/zlib

转到/ your-ruby-dir / ext / zlib

ruby extconf.rb
make
sudo make install

If the packages are missing it will tell you, mainly libzlib related packages

如果包丢失,它会告诉您,主要是libzlib相关包。

Regards

问候

Saurabh

Saurabh

#7


6  

rvm package install zlib
rvm remove 1.9.1
rvm install 1.9.1

That did it. After numerous wild goose chases, I'm glad I found this page.

,做到了。在无数的野鹅追逐之后,我很高兴找到了这一页。

#8


4  

yes, and that didn't do the job either. Got this from another source, this finally did it for me where the other stuff failed.

是的,而且那也没有起到作用。从另一个来源得到这个,这最终为我做了其他事情失败的地方。

wget http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz
tar xvzf ruby-zlib-0.6.0.tar.gz
cd ruby-zlib-0.6.0
ruby extconf.rb && make
sudo make install

Reinstall ruby gems from source

从源代码中重新安装ruby gems。

Thanks anyway, guys.

谢谢,伙计们。

#9


2  

The problem is that Ruby on Ubuntu isn't built against zlib; you'll want to do a source build to install Ruby. You can do this with apt-get source -b ruby

问题是,Ruby on Ubuntu并不是针对zlib构建的;您需要做一个源构建来安装Ruby。你可以用apt-get源-b ruby来做这个。

#10


2  

Did you try apt-get install libzlib-ruby?

你试过安装libzlib-ruby吗?

Also install rubygems from rubyforge. I don't like the rubygems package in Ubuntu.

也可以从rubyforge上安装rubygems。我不喜欢Ubuntu的rubygems包。

#11


2  

On Debian (Squeeze):

在Debian(挤压):

libruby contains zlib for ruby amongst all the other stuff you'll need to make ruby work properly on Debian. So...

libruby包含了ruby中的zlib,在Debian中你需要让ruby正确地工作。所以…

apt-get install libruby

Then...

然后……

cd /usr/local/src/ruby
make clean
make
make install
cd ../rubygems
ruby setup.rb
gem install rails

This made it work for me, but your mileage may vary. I did to a slight shotgun approach to zlib before finding that everything needed was covered by libruby.

这对我来说很有效,但是你的里程可能会有所不同。在发现所有需要的东西都被libruby所覆盖之前,我对zlib采取了一种勉强的方法。

#12


1  

You could try to download the ruby enterprise deb package on the phusion site. And install passenger through the package. Follow the instructions here. Or you could try the bash script found here.

您可以尝试在phusion站点上下载ruby enterprise deb包。并通过包裹安装乘客。按照说明。或者您可以尝试在这里找到的bash脚本。

#13


0  

When running Rails I would not recommend using Ruby 1.8.8dev. Stick with 1.8.6, preferably the Ruby Enterprise Edition. See this post on RailsLab what other people are using.

在运行Rails时,我不建议使用Ruby 1.8.8dev。坚持1.8.6,最好是Ruby企业版。在RailsLab上看到其他人在使用什么。

If you insist on going hi-tech, install Ruby 1.9.1.

如果你坚持走高科技路线,安装Ruby 1.9.1。

But in both cases build it yourself or use Marans suggestion.

但在这两种情况下,都要自己构建或者使用Marans的建议。

#1


297  

If you come across this question trying to install Ruby using Ruby Version Manager (RVM) on Ubuntu 10.04 then there are instructions on installing zlib on the rvm web site http://rvm.beginrescueend.com/packages/zlib/

如果您遇到这个问题,试图在ubuntu10.04上使用Ruby版本管理器(RVM)安装Ruby,那么在RVM web站点上安装zlib会有一些说明,http://rvm.begineend.com/packages/zlib/。

The steps are:

的步骤是:

rvm pkg install zlib

(or rvm package install zlib if you get "ERROR: Unrecognized command line argument: 'pkg'" - older versions of rvm used the verb 'package' instead)

(或rvm包安装zlib,如果您得到“错误:未识别的命令行参数:‘pkg’”——rvm的老版本使用的是“包”)

then

然后

rvm remove 1.9.1
rvm install 1.9.1

#2


52  

I am using Ubuntu 10.04 (Lucid), i wanted to install ruby 1.9.2 because 1.9.1 is not recommended with Rails. So I downloaded the source for 1.9.2 and unzipped/unarchived it. my source distro is ruby-1.9.2-p0. After I unpacked it, I built zlib as follows:

我使用Ubuntu 10.04 (Lucid),我想安装ruby 1.9.2,因为不推荐使用Rails 1.9.1。因此,我下载了1.9.2的源代码,并将其解压缩/未归档。我的源代码发行版是ruby-1.9.2-p0。在打开它之后,我构建了zlib:

cd ruby-1.9.2-p0/ext/zlib
ruby extconf.rb
make
sudo make install
sudo gem install rails

that fixed the problem. This is similar to what other people posted above, but not exactly, so I figured I may as well post exactly what I did to get it going.

固定的问题。这和上面提到的人很相似,但不完全一样,所以我想我可以把我做的事情准确地贴出来。

#3


22  

I have the same problem in CentOS and fix it by executing the following command:

我在CentOS有同样的问题,并通过执行以下命令来修复它:

First, I ensure that zlib and zlib-devel exist (like many suggested above).

首先,我确保zlib和zlib-devel(像上面提到的许多)一样存在。

yum install zlib zlib-devel

Second, I recompiled and installed the sources of zlib that comes with ruby.

其次,我重新编译并安装了带有ruby的zlib源。

cd /home/myname/installers/ruby-1.8.7-p174/ext/zlib/
ruby extconf.rb --with-zlib-include=/usr/include --with-zlib-lib=/usr/lib
make
make install

That commands seem to fix the problem, then I execute gem update --system and the error with zlib vanished. Then I install rails with gem install rails. Note to mention I had installed gem before, and after recompile and install zlib, I don't recompile neither install gem (actually I don't knew how uninstall it because I don't found a script to do that)

这些命令似乎解决了问题,然后我执行gem更新——系统和zlib的错误消失了。然后我用gem安装rails安装rails。注意,我之前已经安装了gem,在重新编译和安装zlib之后,我不会重新编译也不会安装gem(实际上我不知道如何卸载它,因为我没有找到这样做的脚本)

That works for me...hope to you to.

适合我…希望你来。

Regards.

的问候。

#4


12  

try

试一试

aptitude install zlib1g-dev

Then go about your business.

那就去做你的事吧。

#5


8  

I really didn't like any of these answers ... none really focused on the users actual needs and question ... just people telling what they did ... no context and it didn't even work for me ...

我真的不喜欢这些答案……没有人真正关注用户的实际需求和问题……只是人们告诉他们他们做了什么…没有背景,甚至对我都不起作用……

So, ..

所以,. .

I'm installing a new box Ubuntu 8.04 LTS 64-bit ...

我正在安装一个新的box Ubuntu 8.04 LTS 64位…

So, I ...

所以,我……

cd ~  
wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p180.tar.gz  
tar -xvvf ruby-1.9.2-p180.tar.gz  
cd ruby-*  
./configure  
make  
install  
sudo make install  

And then I have this problem with ...

然后我有这个问题。

gem list

it doesn't work ... something about zLib not found crap ...

它不工作…一些关于zLib的东西没有发现垃圾……

So, I actually READ the README and find that I need to edit a file ...

所以,我实际上读了README并发现我需要编辑一个文件…

[my ruby source directory]/ext/Setup

and UN-COMMENT the line with zLib in it ... by removing the "#" in the first column

然后取消注释与zLib的连线。通过删除第一列中的“#”。

Then I run the commands again ... included here for reference ...

然后我再次运行命令…包括在这里供参考…

./configure
make  
install  
sudo make install  

and all is well ... it's logical ... and is devoid of "rvm" and other ... "just install more stuff to make it work" type solutions.

而且一切都很好……它的逻辑…并且缺乏“rvm”和其他…“安装更多的东西,让它工作”类型解决方案。

Joet

Joet

#6


7  

Just goto Ruby Source Package , Unzip it.

只需goto Ruby源代码包,解压它。

Goto /your-ruby-dir/ext/zlib

转到/ your-ruby-dir / ext / zlib

ruby extconf.rb
make
sudo make install

If the packages are missing it will tell you, mainly libzlib related packages

如果包丢失,它会告诉您,主要是libzlib相关包。

Regards

问候

Saurabh

Saurabh

#7


6  

rvm package install zlib
rvm remove 1.9.1
rvm install 1.9.1

That did it. After numerous wild goose chases, I'm glad I found this page.

,做到了。在无数的野鹅追逐之后,我很高兴找到了这一页。

#8


4  

yes, and that didn't do the job either. Got this from another source, this finally did it for me where the other stuff failed.

是的,而且那也没有起到作用。从另一个来源得到这个,这最终为我做了其他事情失败的地方。

wget http://www.blue.sky.or.jp/atelier/ruby/ruby-zlib-0.6.0.tar.gz
tar xvzf ruby-zlib-0.6.0.tar.gz
cd ruby-zlib-0.6.0
ruby extconf.rb && make
sudo make install

Reinstall ruby gems from source

从源代码中重新安装ruby gems。

Thanks anyway, guys.

谢谢,伙计们。

#9


2  

The problem is that Ruby on Ubuntu isn't built against zlib; you'll want to do a source build to install Ruby. You can do this with apt-get source -b ruby

问题是,Ruby on Ubuntu并不是针对zlib构建的;您需要做一个源构建来安装Ruby。你可以用apt-get源-b ruby来做这个。

#10


2  

Did you try apt-get install libzlib-ruby?

你试过安装libzlib-ruby吗?

Also install rubygems from rubyforge. I don't like the rubygems package in Ubuntu.

也可以从rubyforge上安装rubygems。我不喜欢Ubuntu的rubygems包。

#11


2  

On Debian (Squeeze):

在Debian(挤压):

libruby contains zlib for ruby amongst all the other stuff you'll need to make ruby work properly on Debian. So...

libruby包含了ruby中的zlib,在Debian中你需要让ruby正确地工作。所以…

apt-get install libruby

Then...

然后……

cd /usr/local/src/ruby
make clean
make
make install
cd ../rubygems
ruby setup.rb
gem install rails

This made it work for me, but your mileage may vary. I did to a slight shotgun approach to zlib before finding that everything needed was covered by libruby.

这对我来说很有效,但是你的里程可能会有所不同。在发现所有需要的东西都被libruby所覆盖之前,我对zlib采取了一种勉强的方法。

#12


1  

You could try to download the ruby enterprise deb package on the phusion site. And install passenger through the package. Follow the instructions here. Or you could try the bash script found here.

您可以尝试在phusion站点上下载ruby enterprise deb包。并通过包裹安装乘客。按照说明。或者您可以尝试在这里找到的bash脚本。

#13


0  

When running Rails I would not recommend using Ruby 1.8.8dev. Stick with 1.8.6, preferably the Ruby Enterprise Edition. See this post on RailsLab what other people are using.

在运行Rails时,我不建议使用Ruby 1.8.8dev。坚持1.8.6,最好是Ruby企业版。在RailsLab上看到其他人在使用什么。

If you insist on going hi-tech, install Ruby 1.9.1.

如果你坚持走高科技路线,安装Ruby 1.9.1。

But in both cases build it yourself or use Marans suggestion.

但在这两种情况下,都要自己构建或者使用Marans的建议。