CentOS 6.4 + Apache 2.2.15 + Redmine 2.3.2 + backlogs 1.0.6 安装配置 [2013-12-12更新]

来源:互联网 发布:番茄工作法软件 编辑:程序博客网 时间:2024/05/18 01:55
- 安装redmie

# yum -y install gcc gcc-c++ zlib-devel curl-devel openssl-devel apr-devel apr-util-devel mysql-server mysql-devel libxml2 libxml2-devel libxslt libxslt-devel git svn ImageMagick-devel

# cd ~/Downloads
# wget http://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p484.tar.gz
# tar -zxvf ruby-1.9.3-p484.tar.gz -C /usr/src/
# cd /usr/src/ruby-1.9.3-p484/
# ./configure
# make && make install

# cd ~/Downloads
# wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
# tar -zxvf yaml-0.1.4.tar.gz -C /usr/src/
# cd /usr/src/yaml-0.1.4/
# ./configure
# make && make install

# cd ~/Downloads
# wget http://production.cf.rubygems.org/rubygems/rubygems-2.1.7.tgz
# tar -zxvf rubygems-2.1.7.tgz -C /usr/src/
# cd /usr/src/rubygems-2.1.7/
# ruby setup.rb

# gem install bundler mysql mysql2

下载redmine并解压到/var/www/redmine
-------------------------------------------------------------------------------
git方式下载:
# cd /var/www
# git clone git://github.com/redmine/redmine.git
# git tag
# git checkout 2.3.2
-------------------------------------------------------------------------------
进入redmine根目录(若安装过程出现卡顿或错误可重新执行以便继续安装)
# bundle install --without development test
安装完成后会出现以下提示:
Your bundle is complete!
Gems in the groups development, test, postgresql, sqlite and rmagick were not installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

# chkconfig mysqld on
# service mysqld start
# /usr/bin/mysql_secure_installation          // 设置root密码,其余选项按默认即可

# mysql -u root -p
mysql> create database redmine character set utf8;
mysql> create user 'redmine-usr'@'localhost' identified by '123456';
mysql> grant all privileges on redmine.* to 'redmine-usr'@'localhost';
mysql> quit

# iptables -I INPUT -p tcp --dport 80 -j ACCEPT     // 开放80端口
# service iptables save

# cd /var/www/redmine/config
# cp additional_environment.rb.example additional_environment.rb    // 可选
# cp configuration.yml.example configuration.yml                    // 可选
# cp database.yml.example database.yml
# vi database.yml
  production:
    adapter: mysql2
    database: redmine
    host: localhost
    username: root
    password: "mysqladmin"
    encoding: utf8
    
# cd /var/www/redmine
# rake generate_secret_token
# RAILS_ENV=production rake db:migrate
# RAILS_ENV=production rake redmine:load_default_data
# ruby script/rails server webrick -p 80 -e production

至此,在浏览器输入“localhost:80”或“127.0.0.1:80”或“本机IP:端口号”即可访问Redmine(初始账号/密码均为admin)。



- 安装backlogs插件

# cd /var/www/redmine/plugins/
# git clone git://github.com/backlogs/redmine_backlogs.git

# cd redmine_backlogs/                       // 可选
# git checkout vX.Y.Z                        // 可选

# cd /var/www/redmine/
# gem install inifile chronic autotest-rails faye-websocket
# gem install ZenTest -v '4.5.0'
# bundle exec rake db:migrate
# bundle exec rake tmp:cache:clear
# bundle exec rake tmp:sessions:clear
# bundle exec rake redmine:backlogs:install

参考资料:http://www.redminebacklogs.net/en/installation.html



- 关联apache

# yum -y install httpd-devel
# chkconfig httpd on
# cd /var/www/redmine/public
# mv dispatch.fcgi.example dispatch.fcgi
# mv htaccess.fcgi.example .htaccess          // 可选
# chown -R apache:apache /var/www/redmine
# chmod -R 755 /var/www/redmine

# gem install passenger
# passenger-install-apache2-module
====================================================================
安装完成后将生成如下信息:
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.25/buildout/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.25
PassengerDefaultRuby /usr/local/bin/ruby
====================================================================

# vi /etc/httpd/conf/httpd.conf
====================================================================
#ServerName www.sample.com
改为:
ServerName localhost:80

Options Indexes FollowSymLinks
改为:
Options Includes ExecCGI FollowSymLinks

#AddHandler cgi-script .cgi
改为:
AddHandler cgi-script .cgi .pl .fcgi

在文件末尾添加虚拟主机:
<VirtualHost *:80>
    ServerName localhost
    ServerAdmin admin@localhost
    DocumentRoot "/var/www/redmine/public"
    ErrorLog logs/redmine_error_log
    <Directory "/var/www/redmine/public"> 
        Options Indexes ExecCGI FollowSymLinks
        PassengerResolveSymlinksInDocumentRoot on
        Order allow,deny
        Allow from all
        AllowOverride all
    </Directory>
</VirtualHost>
====================================================================

修改environment.rb和dispatch.fcgi
# vi /var/www/redmine/config/environment.rb
在文件开头添加:
ENV['RAILS_ENV'] ||= 'production'
# vi /var/www/redmine/public/dispatch.fcgi
在文件开头添加:
require 'rubygems'
require 'fcgi'

# cd ~/Downloads
# wget http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz
# tar -zxvf mod_fastcgi-current.tar.gz -C /usr/src
# cd /usr/src/mod_fastcgi-2.4.6/
# cp Makefile.AP2 Makefile
# make top_dir=/usr/lib64/httpd
# make install top_dir=/usr/lib64/httpd
(if 32bit OS, use /usr/lib/httpd instead)

创建fcgi配置文件
# vi /etc/httpd/conf.d/mod_fastcgi.conf 
内容如下:
====================================================================
LoadModule fastcgi_module modules/mod_fastcgi.so 
<IfModule mod_fastcgi.c> 
    FastCgiIpcDir /tmp/fcgi_ipc/
</IfModule> 
====================================================================

# chown -R apache:apache /tmp/fcgi_ipc/
# chmod 777 -R /tmp/fcgi_ipc/               // 有安全隐患,但暂无其他方法

# wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
# tar -zxvf fcgi-2.4.0.tar.gz -C /usr/src
# cd /usr/src/fcgi-2.4.0
# vi include/fcgio.h +34
    在第34行加上以下include(为了支持新版的gcc)
    #include <cstdio>
# ./configure
# make && make install

# gem install fcgi 

# chcon -R -h -t httpd_sys_content_t /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.25
# chcon -R -h -t httpd_sys_content_t /var/www/redmine

# service httpd restart     // 此时由于SELinux未正确配置故无法正常启动

-----------------------------------------------------------------------------------------------------------

# vi /etc/httpd/conf.d/passenger.conf
=====================================================================================================
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.25/buildout/apache2/mod_passenger.so

PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.25
PassengerDefaultRuby /usr/local/bin/ruby

PassengerDefaultUser apache
PassengerDefaultGroup apache

PassengerLogLevel 2
PassengerDebugLogFile /var/log/httpd/passenger.log

#PassengerPreStart [YOUR SITE URL]
PassengerMaxPoolSize 2
PassengerPoolIdleTime 300
PassengerTempDir /var/run/rubygem-passenger
=====================================================================================================

# mkdir /var/run/rubygem-passenger
# chown -R apache:apache /var/run/rubygem-passenger
# chcon -R -h -u system_u -t httpd_var_run_t /var/run/rubygem-passenger

# yum -y install setroubleshoot
# setenforce 0
# grep httpd /var/log/audit/audit.log | audit2allow -M passenger
# semodule -i passenger.pp
# setenforce 1
# service httpd restart

# tail /var/log/httpd/error_log      // 查看Apache错误日志



- 邮件配置

# vi /var/www/redmine/config/configuration.yml
! 注意冒号前后的空格
--------------------------------------------------
- 163邮箱配置
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: smtp.163.com
      port: 25
      domain: 163.com
      authentication: :login
      user_name: "your_mail@163.com"
      password: "your_password"
--------------------------------------------------
- Gmail配置
   email_delivery:
     delivery_method: :smtp
     smtp_settings:
       enable_starttls_auto: true
       address: "smtp.gmail.com"
       port: 587
       domain: "smtp.gmail.com"
       authentication: :plain
       user_name: "your_email@gmail.com"
       password: "your_password"
--------------------------------------------------
- 腾讯企业邮箱
   email_delivery:
     delivery_method: :smtp
     smtp_settings:
       address: smtp.exmail.qq.com
       port: 25
       domain: exmail.qq.com
       authentication: :login
       user_name: "your_email@example.com"
       password: "your_password"
--------------------------------------------------

# service httpd restart

! 需配置SELinux

以管理员身份登录Redmine,管理 --> 配置 --> 邮件通知,在“邮件发件人地址”中填入配置文件中配置的地址,点击“保存”,然后点击“发送测试邮件”,若当前管理员邮箱能收到测试邮件则说明配置成功。



- 参考资料

Centos5.5+Redmine2.0.3+backlogs+Apache整合(含备份)
http://wenku.baidu.com/view/0f1b85faf90f76c661371ad2.html

linux(Centos6)安装Redmine 2.2.1
http://blog.csdn.net/winlinvip/article/details/8514333


原创粉丝点击