1. install ruby
tar -zxvf ruby-x.x-stable.tar.gz
cd ruby-x.x.x-xxxx
./configure
make
make install
2. install ruby gems (ruby's package manager)
tar -zxvf rubygems-x.x.x.tgz
cd rubygems-x.x.x
ruby setup.rb
3. install rake (ruby's make)
tar -zxvf rake-x.x.x.tgz
cd rake-x.x.x
ruby rake.rb
* i got this error: no such file to load -- ftools
rake --trace
* shows: no such file to load -- flexmock/test_unit
* try rake.gem
gem install rake --local --no-rdoc
4. install rails
* if you have net connection, do
gem install rails
* else do this (requires activesupport
gem install rails --local --no-doc
requirements:
actionmailer
actionpack
activerecord
activeresource
activesupport
rack
rails
rake
gem install activerecord --local --no-rdoc
gem install activesupport --local --no-rdoc
gem install rack-x.x.x.gem --local --no-rdoc
gem install rails-x.x.x.gem
5. setup your rails server
rails path/to/your/new/application
cd path/to/your/new/application
ruby script/server
You're running Ruby on Rails! Follow the instructions on http://localhost:3000
6. setup mysql on ruby
tar -zxvf mysql-ruby-x.x.x.tar.gz
cd mysql-ruby-x.x.x
ruby extconf.rb
make
make install
in config/database.yml
adapter: mysql
database: test
host:
username:
password:
check if it works by going to http://localhost:3000 and clicking 'about..'
7. setup RoR server
install eventsmachine, daemons and thin
gem install eventmachine-x.x.x.gem --local --no-rdoc
gem install daemons-x.x.x.gem --local --no-rdoc
gem install thin-x.x.x.gem --local --no-rdoc
cd /usr/local/rails/Rails2/
thin start
or for background:
thin start -d
or for environment:
thin start -d -e production
or for cluster of 3:
thin start --servers 3
to stop
thin stop
or
thin stop --servers 3
add runlevels
thin install
chkconfig --level 345 thin on
chkconfig --list | grep thin
create config file
thin config -C /etc/thin/testapp.yml -c /usr/local/rails/Rails2/ --servers 3 --e development
cat /etc/thin/testapp.yml
8. setup RoR on apache
create your rails app directory in your public folder
cd /usr/local/apache2/htdocs
rails railstest
edit your httpd.conf and place
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /usr/local/apache2/htdocs/railstest/public
RewriteEngine On
BalancerMember http://127.0.0.1:3000
BalancerMember http://127.0.0.1:3001
BalancerMember http://127.0.0.1:3002
# Redirect all non-static requests to thin
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://thinservers%{REQUEST_URI} [P,QSA,L]
ProxyPass / balancer://thinservers/
ProxyPassReverse / balancer://thinservers/
ProxyPreserveHost on
Order deny,allow
Allow from all
# Custom log file locations
ErrorLog /usr/local/apache2/htdocs/railsapp/log/error.log
CustomLog /usr/local/apache2/htdocs/railsapp/log/access.log combined
No comments:
Post a Comment