V. Installing the RAILS Environment
Rails environment uses mongrel erection.
1. Install Ruby
TAR-ZXVF ruby-1.8.6.tar.gz
CD ruby-1.8.6
./configure–prefix=/usr/local/ruby
Make
Make install
Add Ruby to Path
Vi/etc/profile
Ruby_home=/usr/local/ruby
Path= "${ruby_home}"/bin: "${java_home}"/bin:/usr/local/mysql/bin: "${path}"
Export PATH
Exit root, re-log in root to verify that Ruby is installed successfully
Ruby-v
Displays the version number indicating that the installation was successful
2. Install Gem
TAR-ZXVF rubygems-0.9.4.tgz
CD rubygems-0.9.4
Ruby Setup.rb
rubygems-0.9.5 seems to have a problem, no matter what the gem package is said SSL is not installed, reinstall a rubygems-0.9.4 is no problem.
3. Installation Rails/mongrel/termios
Apt-get Install Libssl-dev
Gem Install Rake–include-dependencies
Gem Install Rails–include-dependencies
Gem Install Termios–include-dependencies
Gem Install Mongrel–include-dependencies
Gem Install Mongrel_cluster–include-dependencies
To create a default site (or upload a Web site that has already been developed and configure a database), go to the Site Directory
Mongrel_rails cluster::configure-e production-p 8000-n 3-c/home/dingl/rails-web/-a 127.0.0.1
Configure the database in Database.yml, here is the production environment, configure production segment.
If you need to use socket to connect to MySQL, add:
Socket:/tmp/mysql.sock
You can also specify the data transfer encoding:
Encoding:utf8
4, start mongrel:
Mongrel_rails Cluster::start
If the following error occurs:
Cannot find gems for Rails ~>1.2.3.0:
Install the missing gem with ' Gem install-v=1.2.3 rails '
You can change the version number of rails in config/environment.rb.
5, configure Apache and mongrel:
To modify the Apache configuration file:
Vi/usr/local/apache/conf/httpd.conf
Add a virtual host at the end of the file:
<virtualhost *:80>
ServerName http://www.111cn.net/
Rewriteengine on
documentroot/home/dingl/rails-web/
Proxyrequests off
<proxy balancer://mongrel_cluster>
Balancermember http:/