RMagick is an interface between the Ruby programming language and the ImageMagick® and GraphicsMagick image processing libraries.
To install RMagick on CentOS 4 you’ll need to install RMagick version 1 because version 2 requires newer version of ImageMagick that’s not available in CentOS 4 repositories.
I do assume that you already have installed RubyGems, install required libraries:
$ sudo yum install gcc gcc-c++ ImageMagick-devel ghostscript \ freetype-devel libjpeg-devel libpng-devel \ libpng10-devel libwmf-devel libexif-devel libtiff-devel [...]
Then install RMagick gem version 1.15.14 using ‘-v’ switch:
$ gem install rmagick -v 1.15.14 Building native extensions. This could take a while... Successfully installed rmagick-1.15.14 1 gem installed