如您需要技术咨询、解决方案定制、故障排除、运维监控等服务,可联系ericwcn#at#163.com。

Redmine 3.2 安装配置指南 CentOS6/7

Linux 立杰 254℃

1.Redmine简介

Redmine是用Ruby开发的基于WEB的项目管理软件,是用ROR框架开发的一套跨平台项目管理系统,支持多种数据库,有不少自己独特的功能,例如提供WIKI、新闻台等,还可以集成其他版本管理系统和BUG跟踪系统,例如PERFORCE、SVN、CVS、TD等等。这种 WEB 形式的项目管理系统通过“项目(PROJECT)”的形式把成员、任务(问题)、文档、讨论以及各种形式的资源组织在一起,大家参与更新任务、文档等内容来推动项目的进度。

2.Ruby基础环境配置(RVM/Ruby/Rails)

2.1.安装RVM

$ curl -L https://get.rvm.io | sudo bash -s stable
#将用户加入rvm组
#若部分用户无法执行rvm命令,可以通过重启,使其生效
$ usermod -a -G rvm wlj

确认rvm版本

$ rvm -v
rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

2.2.安装Ruby必要的组件

$ rvm requirements

2.3安装Ruby 2.3

Ruby安装目录为/usr/loca/rvm/rubies

$ rvm install 2.3

2.4设置当前Ruby使用版本

$ rvm use 2.3 --default
Using /usr/local/rvm/gems/ruby-2.3.0
$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
$ rvm -v
rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
$ gem -v
2.5.1

使用Taobao RubyGems镜像,提高安装的速度和成功率,否则可能会因为网络问题无法正常安装软件包

$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
$ gem sources -l
*** CURRENT SOURCES ***

https://gems.ruby-china.org
# 请确保只有 gems.ruby-china.org
$ bundle config mirror.https://rubygems.org https://gems.ruby-china.org

2.5安装Rails

在生产环境中,可以不安装说明文档,默认Rails安装在/usr/local/rvm/gems/ruby2.3.0/gems/目录下。

$ gem install rails --no-rdoc --no-ri

3.安装配置Apache、MySQL、Passenger

3.1安装Apache/MySQL

yum install httpd mysql mysql-server ruby-mysql mysql-libs mysql-devel

3.2使用 Gem 安裝 Passenger

$ gem install passenger

3.3安裝 Apache Passenger 模块

# CENTOS
$ yum install libcurl-devel httpd-devel apr-devel apr-util-devel 
$ passenger-install-apache2-module

如果在安装过程中出现错误,安装程序的提示解决方案处理即可。

3.4在Apache中配置Passenger

程序安装过程中会提示将下列配置文件加入Apache 配置文件中。

#CentOS 6
vim /etc/httpd/conf.d/passenger.conf
<IfModule mod_passenger.c>
	PassengerRoot /usr/local/rvm/gems/ruby-2.3.0/gems/passenger-5.0.29
	PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.3.0/wrappers/ruby
</IfModule>

#CENTOS 7
 LoadModule passenger_module /usr/local/rvm/gems/ruby-2.3.3/gems/passenger-5.1.2/buildout/apache2/mod_passenger.so
 <IfModule mod_passenger.c>
 PassengerRoot /usr/local/rvm/gems/ruby-2.3.3/gems/passenger-5.1.2
 PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby
 </IfModule>

3.5在Apache中配置Redmine虚拟机

#CentOS6
vim /etc/httpd/conf.d/redmine.conf
#强制用户使用https访问站点
<VirtualHost *:80>
  ServerName redmine.wanglijie.cn
  DocumentRoot /opt/redmine/redmine/public
  Redirect "/" "https://redmine.wanglijie.cn/"
</VirtualHost>

<VirtualHost *:443>
        DocumentRoot /opt/redmine/redmine/public
        ServerName redmine.wanglijie.cn:443

        ErrorLog logs/ssl_redmine_error_log
        TransferLog logs/ssl_redmine_access_log
        LogLevel warn

        SSLEngine on
        SSLProtocol all -SSLv2
        SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
        SSLCertificateFile /etc/pki/ssl/redmine.wanglijie.cn/Apache/2_www.crt
        SSLCertificateKeyFile /etc/pki/ssl/redmine.wanglijie.cn/Apache/3_www.key
        SSLCACertificateFile /etc/httpd/conf/ssl.crt/root_bundle.crt

        <Files ~ "\.(cgi|shtml|phtml|php3?)$">
                SSLOptions +StdEnvVars
        </Files>

        <Directory "/opt/redmine/redmine/public/">
             # This relaxes Apache security settings.
             AllowOverride all
             # MultiViews must be turned off.
             Options -MultiViews
             # Uncomment this if you're on Apache >= 2.4:
             #Require all granted
        </Directory>
</VirtualHost>        

Apache子目录部署

<VirtualHost *:80>
    ServerName redmine.wanglijie.cn
    DocumentRoot /var/www/html
    Alias /redmine /opt/redmine/redmine/public
    <Location /redmine>
        PassengerBaseURI /redmine
       #注意:目录是/opt/redmine/redmine,不是redmine/public
        PassengerAppRoot /opt/redmine/redmine
     </Location>
     <Directory "/opt/redmine/redmine/public">
        Options -MultiViews
        AllowOverride All
         <IfVersion < 2.3 > Order allow,deny Allow from all </IfVersion>
         <IfVersion >= 2.3>
        Require all granted
         </IfVersion>
    </Directory>
</VirtualHost>

3.6重新载入Apache2配置文件

service httpd reload

3.7 为Redmine创建独立的MySQL用户和数据库

$ mysql -u root -p
Enter password:

mysql>CREATE DATABASE redmine CHARACTER SET utf8;
mysql>CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'qBuJEx7xxxsJweX';
mysql>GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
mysql>flush privileges;
mysql>exit;

4.安装Redmine

下载Redmine安装包并解压到/opt/redmine/

$ wget http://www.redmine.org/releases/redmine-3.3.0.tar.gz
$ tar -xzvf -C /opt/redmine/ redmine-3.3.0.tar.gz
$ ln -s /opt/redmine/redmine-3.3.0 /opt/redmine/redmine

修改配置文件,并保存在conf目录

$ cp /opt/redmine/redmine/config/database.yml.example /opt/redmine/redmine/config/database.yml
$ vim /opt/redmine/redmine/config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "qBuJEx7xxxsJweX"
  encoding: utf8

$ cp /opt/redmine/redmine/config/configuration.yml.example /opt/redmine/redmine/config/configuration.yml
$ vim /opt/redmine/redmine/config/configuration.yml
default:
  email_delivery:
  attachments_storage_path: /opt/redmine/redmine/attachments_files_redmine
  autologin_cookie_name:
  autologin_cookie_path:
  .....
  scm_darcs_path_regexp:
  scm_filesystem_path_regexp:
  scm_stderr_log_file: /var/log/redmine/redmine_scm_stderr.log
  database_cipher_key:
  rmagick_font_path:
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: 127.0.0.1
      port: 25
      domain: redmine.wanglijie.cn
development:

创建Redmine附件文件保存目录和日志文件目录

$mkdir /opt/redmine/redmine/attachments_files_redmine
$mkdir /var/log/redmine

安装配置Bundler

$ gem install bundler --no-rdoc --no-ri
$ yum install zlib* openssl* ImageMagick-devel –y
$ gem install mysql2
#安装rbpdf-font
$ gem install rbpdf-font
$ bundle install --without development test postgresql sqlite

为Rails生成cookies秘钥

$ rake generate_secret_token

如果发生mysql错误,需要再安装gem的mysql2.在当前安装版本存在如下错误:

解决方法是编辑 expanded.rb,注视465行:

vim /usr/local/rvm/gems/ruby-2.3.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb
 465     #'inodot'         => 0x0131,   # ı   dup            LATIN SMALL LETTER DOTLESS I
 466     'inodot'         => 0x0131,   # ı   dup            LATIN SMALL LETTER DOTLESS I

生成Redmine数据库结构

$ cd /opt/redmine/redmine/
$ RAILS_ENV=production rake db:migrate

生成缺省数据

$ RAILS_ENV=production REDMINE_LANG=zh rake redmine:load_default_data

重启Redmine 服务,可以直接重启Apache 服务即可全部重启.

参考:http://www.redmine.org/projects/redmine/wiki/FedoraInstallation

转载请注明:知识库 » Redmine 3.2 安装配置指南 CentOS6/7

喜欢 (0)