Trouble installing rails on CentOS 5.2

My PC is running CentOS 5.2 with Ruby 1.8.6 and Ruby-devel package
installed. I have installed RubyGems by downloading rubygems-1.3.1.tgz

Now I am trying to install Rails by the following command:

gem install rails

It gives the following error:

ERROR: While executing gem ... (Zlib::DataError)
    incorrect header check

I have tried installing other gem packages like hpricot, needle. They
all are installed successfully but I cannot install rails.

Can somebody please give me a way to resolve this?


Are you running 64-bit? If so, do you have both 32-bit and 64-bit zlib installed?

yum list installed

zlib.i386 1.2.3-3 installed

zlib.x86_64 1.2.3-3 installed

zlib-devel.i386 1.2.3-3 installed

zlib-devel.x86_64 1.2.3-3 installed



I am running 32-bit. zlib and zlib-devel are already installed on my PC.