How to install Ruby on Rails on Centos 6
I’ve had trouble finding a decent guide on installing Ruby in Centos 6. There are a few good guides out there but none quite did the trick for me, whether it’s changes in Centos or just a different system setup I don’t know but this is what worked for me.
yum update yum -y groupinstall "Development Tools" yum -y install ntp zlib zlib-devel sqlite-devel httpd mysql-server mysql-devel curl-devel httpd-devel apr-devel apr-util-devel mlocate manlibxml2-devel libxslt-devel libffi-devel readline-devel
sudo curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable source /etc/profile.d/rvm.sh
Install ruby, gems and rails
rvm install 1.9.3 rvm use 1.9.3 --default ruby --version gem install rails
gem install passenger passenger-install-apache2-module
The final command will output something like the below, just do as it suggests.
Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.17/buildout/apache2/mod_passenger.so PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.17 PassengerDefaultRuby /usr/local/rvm/wrappers/ruby-1.9.3-p448/ruby After you restart Apache, you are ready to deploy any number of Ruby on Rails applications on Apache, without any further Ruby on Rails-specific configuration! Press ENTER to continue. Deploying a Ruby on Rails application: an example Suppose you have a Rails application in /somewhere. Add a virtual host to your Apache configuration file and set its DocumentRoot to /somewhere/public: ServerName www.yourhost.com # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /somewhere/public # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews And that's it! You may also want to check the Users Guide for security and optimization tips, troubleshooting and other useful information: /usr/local/rvm/gems/ruby-1.9.3-p448/gems/passenger-4.0.17/doc/Users guide Apache.html Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) <img src="http://www.tiag.me/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley" /> https://www.phusionpassenger.com Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
Like this Article? Share it!
About the Author
Andy has been in IT support in the academic industry for over 7 years now, with an in-depth knowledge of both Windows and Unix based systems.