install ruby in centos6

1. Step One—Install Ruby

The easiest way to install Ruby on your virtual server is through the yum package installer.

sudo yum install ruby
After you say yes to the prompt, Ruby will install.

Then we need some additional Ruby dependancies.

Type the following into terminal:

1
2
sudo yum install gcc g++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel
sudo yum install ruby-rdoc ruby-devel

While it processes, the prompt may ask your permission to install the various packages. Go ahead and say yes each time.

2. Step Two—Install Ruby Gems

Once you have Ruby installed, you can easily install the ruby gems.

Type this command into terminal:

sudo yum install rubygems

Building from Source

Of course, you can install Ruby from source. Download and unpack a tarball, then just do this:

1
2
3
$ ./configure
$ make
$ sudo make install

By default, this will install Ruby into /usr/local. To change, pass the –prefix=DIR option to the ./configure script.