« Setting up a Ruby on Rails server - Part 1 | Home | Just a quick Technorati intermezzo »

Setting up a Ruby on Rails server - Part 2 - install Ruby, Rubygems and Rails

By Nick | March 29, 2007

Installing Ruby and Rubygems on CentOS turned out to be not that simple. First of all you can’t just say ‘yum install ruby’, because there won’t be a version of Ruby higher than 1.8.4 available. So the easiest way to install Ruby is from source. In order to get Ruby and Rubygems running smoothly, you have to make sure the zlib library is installed, otherwise you get all sorts of errors and you can start all over again.

Install zlib:

yum install zlib-devel

wget http://www.zlib.net/zlib-1.2.3.tar.gz
tar xvfz zlib-1.2.3.tar.gz
cd zlib-1.2.3
make test
make install

Once zlib is installed you can start with Ruby (note that I haven’t got the latest version of Ruby installed):

wget ftp://ftp.ruby-lang.org/pub/ruby/stable/ruby-1.8.4.tar.gz
tar -zxvf ruby..
yum install gcc
make install

You can test your Ruby installation with the command: ruby -v

To finish you need to install Rubygems in order to install other gems (again note that I have n’t got the latest version of Rubygems)

wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz
tar -zxvf rubygems-0.9.0.tgz
ruby setup.rb

After the installation you should update Rubygems, in order to do so run the command: gem update –system

In case you can’t install Rubygems, because it gives you a zlib error you need to make sure you remove everything from Ruby and Rubygems and start all over again.

Once all the above is installed you can finally install Rails, which is the easy part, just enter:

gem install rails --include-dependencies

And your done, Rails should be running!
Next stop, install MySQL to interact with.

Topics: Uncategorized |