環(huán)境需求:
CentOS6.2 + ruby1.9.2 + rails3.2.6 + redmine2.0.3 + rubygems1.3.7 (版本很重要)
1、關(guān)掉selinux和iptables
sed -i s/\=enforcing/\=disabled/g /etc/selinux/configchkconfig --level 35 iptables offchkconfig --level 35 ip6tables off
2、安裝相關(guān)的rpm包
yum -y install vim-enhanced wget ntp gcc gcc-c++ make automake autoconf mysql-devel libxml2-devel curl-devel patch libxslt-devel libxslt cyrus-sasl-devel openssh openssh-clients subversion pcre-devel httpd
3、安裝ruby-1.9.2
tar zxvf ruby-1.9.2-p290.tar.gzcd ruby-1.9.2-p290/./configure make && make installcd ext/opensslruby extconf.rbmake && make install ruby -v(檢查安裝版本)#ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
4、安裝rails3.2.6
gem install rails -v=3.2.6
5、安裝mysql數(shù)據(jù)庫(kù)
yum -y install mysql-servermv /etc/my.cnf /etc/my.cnf.bakcp /usr/share/mysql/my-huge.cnf /etc/my.cnfchown -R mysql.mysql /var/lib/mysql /usr/bin/mysql_install_db service mysqld start/usr/bin/mysqladmin -u root password '123456'/usr/bin/mysql -u root -p123456> create database redmine character set utf8;> quit
6、安裝redmine
wget http://rubyforge.org/frs/download.php/76259/redmine-2.0.3.tar.gztar zxvf redmine-2.0.3.tar.gzcp -rf redmine-2.0.3 /var/www/html/redminecd /var/www/html/redmine/config/cp database.yml.example database.ymlvi database.ymlproduction: adapter: mysql2 database: redmine host: localhost username: redmine password: redmine encoding: utf8 ## 注:文件內(nèi)的adapter項(xiàng)要寫mysql2,否則會(huì)報(bào)RuntimeError: Please install the mysql adapter: `gem install activerecord-mysql-adapter`
7、開始bundle install在執(zhí)行bundle時(shí)要監(jiān)測(cè)多項(xiàng)應(yīng)用安裝情況包括:mysql、postgresql、sqlite3、ImageMagick等,有一項(xiàng)沒安裝都會(huì)報(bào)錯(cuò),解決思路:提示安裝卻什么,就安裝什么。
yum -y install postgresql-server postgresql-develyum -y install ImageMagick ImageMagick-develyum -y install sqlite-devel gem install pg -v '0.14.0'gem install rmagick -v '2.13.1'gem install sqlite3 -v '1.3.6' bundle install --without development test (出現(xiàn)綠字側(cè)成功)
8、配置redmine
rake generate_secret_token (生成會(huì)話存儲(chǔ)密鑰)RAILS_ENV=production rake db:migrate (創(chuàng)建數(shù)據(jù)庫(kù)結(jié)構(gòu))RAILS_ENV=production rake redmine:load_default_data (載入默認(rèn)配置,之后會(huì)有語(yǔ)言選擇,選"zh")ruby script/rails server webrick -e production (若是想webrick像服務(wù)一樣啟動(dòng)加-d參數(shù))
9、測(cè)試
http://localhost:3000
二、集成apache
Redmine默認(rèn)使用RoR自帶的web服務(wù)器WEBrick,默認(rèn)的端口是3000,速度一般;很多人將Redmine集成到apache,nginx或 tomcat中,集成到apache通常采用CGI方式來(lái)集成,配置起來(lái)比較繁雜。Phusion Passenger組件是專門為apache和nginx開發(fā)的用來(lái)部署Ruby on Rails應(yīng)用的,配置起來(lái)非常的方便,使用下來(lái)感覺頁(yè)面的操作速度比WEBrick要快很多,本文記錄了如何安裝passenger來(lái)集成 Redmine到apache服務(wù)器。
環(huán)境信息:
CentOS6.2
Redmine 2.0.3
Passenger 3.0.14
1、安裝依賴庫(kù)
yum -y install httpd-devel apr-devel apr-util-devel
2、安裝passenger
gem install passengerpassenger-install-apache2-module
3、修改apache配置文件
passenger成功安裝后,它會(huì)給出如下的配置提示信息,需要將它們添加到apache的配置文件 /etc/httpd/conf/httpd.conf 中(不通版本目錄名稱不一樣)
vi /etc/httpd/conf/httpd.confLoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.15/ext/apache2/mod_passenger.soPassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.15PassengerRuby /usr/local/bin/ruby
在httpd.conf中添加虛擬主機(jī):
<virtualhost *:80> ServerName redmine.wangzhe.me ServerAdmin admin@wangzhe.me DocumentRoot /var/www/html/redmine/public ErrorLog logs/redmine_error_log <directory "/var/www/html/redmine/public" > Options Indexes ExecCGI FollowSymLinks -MultiViews Order allow,deny Allow from all AllowOverride all </directory></virtualhost>
3、重啟apache
/etc/init.d/httpd restart
聯(lián)系客服