CentOS安装Ruby

安装依赖

yum install zlib-devel curl-devel openssl-devel apr-devel apr-util-devel expat-devel gettext-devel readline-devel gdbm-devel tcl-devel tk-devel

手动安装libyaml否则会提示“yaml.h is missing. Please install libyaml. Failed to configure psych. It will not be installed.”

wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz

tar zxf yaml-0.1.4.tar.gz

cd yaml-0.1.4

./configure --prefix=你的目录

make

make install

手动安装libffi否则会提示“ffi.h is missing”

wget ftp://sourceware.org/pub/libffi/libffi-3.0.11.tar.gz

tar zxf libffi-3.0.11.tar.gz

cd libffi-3.0.11

./configure --prefix=你的目录

make

make install

ln 安装目录/lib/libffi-3.0.11/include/ffi.h /usr/local/include/ffi.h

安装ruby 1.8(1.9的digest有问题,不知道何故)

wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz

tar zxf ruby-1.8.7.tar.gz

cd ruby-1.8.7

./configure --prefix=你的目录 --enable-shared --enable-pthread

make

make install

1.9内含rubygem,但1.8要手动安装:

wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz

tar zxf rubygems-1.8.24.tgz

cd rubygems-1.8.24

ruby setup.rb

就是这样。搞定。

1 comment

Leave a comment