环境:Fedora 9
1. 安装 ruby
[root@www ~]# yum install ruby* -y
2. 更新ruby
[root@www ~]# gem update –system
[root@www ~]# gem update
3.install Rails and dependencies
[root@www~]gem install rails –include-dependencies
4.安装常用的gem包
[root@www ~]# gem install ruby-debug ruby-debug-base sqlite3-ruby
Successfully installed ruby-debug-0.10.2
Building native extensions. This could take a while…
Successfully installed ruby-debug-base-0.10.2
Building native extensions. This could take a while…
Successfully installed sqlite3-ruby-1.2.4
3 gems installed
Installing ri documentation for ruby-debug-0.10.2…
Installing ri documentation for ruby-debug-base-0.10.2…
Installing ri documentation for sqlite3-ruby-1.2.4…
Installing RDoc documentation for ruby-debug-0.10.2…
Installing RDoc documentation for ruby-debug-base-0.10.2…
Installing RDoc documentation for sqlite3-ruby-1.2.4…
[root@www ~]#
5. install Mongrel
方法同4
[root@www ~]# gem install mongrel
6. 若使用mysql, 还可能需要执行以下操作
[root@www ~]# yum install mysql*
[root@www ~]# gem install mysql
7. 安装 & 配置Apache
[root@www~]yum install httpd
新建/etc/httpd/conf.d/rails.conf内容如下
Listen 8080
ProxyRequests Off
BalancerMember http://127.0.0.1:3001
BalancerMember http://127.0.0.1:3002
#BalancerMember http://127.0.0.1:3003
#BalancerMember http://127.0.0.1:3004
#BalancerMember http://127.0.0.1:3005
ServerName www.laiyunqing.com:8080
DocumentRoot /var/www/beeblio/public
ProxyPass /image !
ProxyPass /stylesheets !
ProxyPass /javascripts !
ProxyPass / balancer://myCluster/
ProxyPassReverse / balancer://myCluster/
ProxyPreserveHost on
然后在3001,3002…3005端口启动mongrel
mongrel_rails start -e production -p 3001 -d -c /var/www/beeblio/ -P /var/www/beeblio/log/mongrel-3001.pid
mongrel_rails start -e production -p 3001 -d -c /var/www/beeblio/ -P /var/www/beeblio/log/mongrel-3002.pid
…
8. 重启apache,试试地址栏中输入http://localhost:8080,该工作了吧?
[root@www~]service httpd restart