1. First the system will need the appropriate packages to compile and install the source code for ruby. To do this run the following command.
yum -y install make gcc openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel curl-devel expat-devel gettext-devel ncurses-devel sqlite3-devel mysql-devel httpd-devel wget which
2. Now that a compiler package is installed move on to download, compile and install the libyaml library.
cd /usr/src 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=/usr/local make && make install
3. The next step is to download, compile and install Ruby 1.9.3.
cd /usr/src wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz tar zxf ruby-1.9.3-p0.tar.gz cd ruby-1.9.3-p0 ./configure --prefix=/usr/local --disable-install-doc --with-opt-dir=/usr/local/lib make && make install
4. Upon completion of steps 1 through 3 ruby is accessible via command line. Test ruby by running the following command.
[root@new-host-2 ~]# ruby -v ruby 1.9.3p0 (2011-10-30 revision 33570)
The guide will help get Ruby working on a CentOS system, later I will cover what you can do with Ruby.