#安装编译环境
yum groupinstall "Development tools"
或者
yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel
#删除已经安装的项目:
yum erase ruby ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs
#安装依赖:
yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel
#下载Ruby源码并解压缩:
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.5.tar.gz
tar zxvf ruby-2.1.5.tar.gz
#编译安装:
cd ruby-2.1.5.tar.gz
./configure
make
make install
#检查安装:
ruby -v
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-linux]