How to Install Ruby on Rails on CentOS 4.4
I thought that others might find it useful if I listed how I re-installed Ruby on Rails on to my server after its recent disk failure.
The steps:
- Ruby
- Gems
- Ruby on Rails
- Mongrel
- Website
- Configuration of Rails
- Apache http configuration
Ruby
change directory to a temporary and get the Ruby rpm files from the web:
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-devel-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-docs-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-irb-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-libs-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-mode-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-mysql-2.7-8.el4.centos.i386.rpm (NO NEED TO LOAD IF YOU HAVE A DB)
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-postgres-0.7.1-4.el4.centos.i386.rpm (NO NEED TO LOAD IF YOU HAVE A DB)
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-rdoc-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-ri-1.8.5-1.el4.centos.i386.rpm
wget http://dev.centos.org/centos/4/testing/i386/RPMS/ruby-tcltk-1.8.5-1.el4.centos.i386.rpm
Use rpm –ivh packagename to install
Gems
Download latest Gems:
wget http://rubyforge.org/frs/download.php/17190/rubygems-0.9.2.tgz
tar zxf rubygems-0.9.2.tgz
cd rubygems-0.9.2
sudo ruby setup.rb
Ruby on Rails
Install rails
sudo gem install rails
Install mysql bindings
sudo gem install mysql -- --with-mysql-include=/usr/include/mysql\ --with-mysql-lib=/usr/lib/mysql --with-mysql-config
Update to latest version of Rails.
Mongrel
sudo gem install mongrel
change directory to the root directory of website then:
mongrel_rails start -p 4000
Website
FTP the contents of the Ruby on Rails directory to the root of the public http directory on the server.
Configuration of Rails
If you already have a database for your Ruby on rails application dump it then use phpmyadmin to create a database then upload the dumped database.
Then update the config/database.yml file onthe sever for user, passwords, socket and database name.
Apache http configuration
I use Direct Admin on my server so it is easy to change the apache configuration.
You may have to change httpd.conf to include the proxy module first take the # from these lines:
#LoadModule proxy_module modules/libproxy.so
#AddModule mod_proxy.c
Then add the following lines to the http config file:
ProxyPass / http://www.itsdargens.com:4000/
ProxyPassReverse / http://www.itsdargens.com:4000/
Backslash very important!
Links
http://railswiki.involution.com/index.php/Main_Page