Ruby on Rails on Centos 5.2
Installing / Configuring
On a base install, first get the dependencies:
You can check to see if the version of ruby is acceptable, if not, it’s easy to install from source. As of this writing, that was version 1.8.5, which is old. Centos-plus still doesn’t have a newer version. Grab a copy of ruby from http://www.ruby-lang.org/en/downloads/:
While you’re at it, grab a copy of rubygems from http://rubyforge.org/frs/?group_id=126
Untar, extract ruby:
cd ruby-1.8.7
./configure
make
sudo make install
Untar, extract rubygems:
tar xzvf rubygems-1.3.1.tgz
cd rubygems-1.3.1
sudo ruby setup.rb
Note that I had to logout and log back in (re-run profile) to ensure that the new ruby installed in /usr/local/bin was being read, and not the ruby in /usr/bin. Tested with ruby -v.
Next, install rails:
Install your Database of choice (you may want postgres, other dbs):
And install any other gems:
–with-mysql-include=/usr/include/mysql \
–with-mysql-lib=/usr/lib/mysql
Note: Felippe Silvestre reports that he had to add an additional mysql_config option on his install (it has also been reported that only supplying the mysql_config option works, your results may vary):
–with-mysql-include=/usr/include/mysql \
–with-mysql-lib=/usr/lib/mysql \
–with-mysql-config=/usr/lib/mysql/mysql_config
Install passenger (mod_rails):
sudo passenger-install-apache2-module
Follow the directions for passenger, and you’re done.
Troubleshooting
If apache won’t start after installing passenger, make sure you’re SELinux is not enabled. I couldn’t get it to work with enabling the correct permissions using chcon, so I just disabled by:
and then turning it off on reboot by editing /etc/selinux/config and setting it to permissive (instead of enforcing).
If you get errors abour readline when running script/console for Rails, it probably means that ruby was not compiled with readline (readline-devel) support. If you skipped installing the readline-devel packages, this can happen.
