centos6.5搭建redmine3.4

眉间皱痕 提交于 2020-02-24 17:36:13

  缺陷管理,对问题的持续跟踪!redmine很棒的基于ruby开发

Redmine部署架构  mysql+nginx+ruby+redmine 3.4.x

部署环境

centos 6.5 x64
redmine-3.4.6.tar.gz
http://www.redmine.org/releases/redmine-3.4.6.tar.gz
http://www.redmine.org/projects/redmine/wiki/RedmineInstall  //安装说明

redmine 版本:3.4.x  //根据官方查看依赖的ruby版本
ruby 版本: 2.4.x  //rvm
rails 版本 : 4.2
mysql      :5.6+
MySQL 5.6 or higher and MariaDB have known issues (#19344, #19395, #17460).
Redmine 4.0.0 does not support MySQL <5.5

Redmine version Supported Ruby versions Rails version used
4.0 (upcoming) ruby 2.2(2.2.2 and later), 2.3, 2.41 Rails 5.1
3.4 ruby 1.9.34, 2.0.03, 2.1, 2.22, 2.3, 2.41 Rails 4.2
3.3 ruby 1.9.34, 2.0.03, 2.1, 2.22, 2.3 Rails 4.2
3.2 ruby 1.9.34, 2.0.03, 2.1, 2.22 Rails 4.2

01、rvm安装

#rvm实现对ruby多版本的管理自由切换

useradd ruby && su - ruby  //adduser
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3    //导入秘钥
curl -sSL https://get.rvm.io | bash -s stable   //setup-rvm
source ~/.rvm/scripts/rvm && source ~/.bashrc && source ~/.bash_profile

echo "ruby_url=https://cache.ruby-china.org/pub/ruby" > ~/.rvm/user/db  //修改国内源ruby下载

#root执行安装
yum install -y patch autoconf automake bison gcc-c++ libffi-devel libtool patch readline-devel sqlite-devel zlib-devel openssl-devel
rvm requirements  //安装ruby编译库

02、安装ruby

rvm list knownrvm install 2.2.3   //默认二进制安装

rvm install 2.2.3 --disable-binary  //源码编译安装

rvm use 2.2.3 --default

03、安装rails


////修改gem源-国内的
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
gem install rails
gem install rails -v=4.2 -V  //安装rails 4.2,显示过程-V  安装过程5min+

Bundler 的 Gem国内源
bundle config mirror.https://rubygems.org https://gems.ruby-china.org

04、安装redmine


redmine-3.4.6.tar.gz
http://www.redmine.org/releases/redmine-3.4.6.tar.gz
tar -zxf redmine-*.tar.gz && cd redmine-*
#在redmine家目录执行依赖gem安装
gem install bundler #注意是在网站根目录下执行,自动安装依赖

#安装redmine依赖的所有ruby包
yum install -y ImageMagick ImageMagick-devel  //
#RMagick (allows the use of ImageMagick to manipulate images for PDF and PNG export)
#bundle install --without development test rmagick  //不安装ImageMagick
#bundle install --without development test #完成redmine依赖包的安装
bundle install --without development test postgresql sqlite --no-deployment
#bundle install --without development test postgresql sqlite --deployment

05、安装MySQL


mysql-5.6.28
root/erwsdfd123  //mysql-ruby-running

create database red_test;
grant all on red_test.* to 'red'@'localhost' identified by '123123';

//安装gem mysql2
yum install mysql-devel  //apt-get install libmysqlclient-dev
gem install  mysql2 -v=0.4.6

配置Redmine的database.yml
cp config/database.yml.example config/database.yml
cat database.yum #修改对应数据库连接信息
production: 
  adapter: mysql2
  database: redmine
  host: 127.0.0.1  //localhost是本地sock连接的,ip是通过tcp/ip连接
  username: redmine
  password: "my_password" 
  encoding: utf8

#Rails生成cookies秘钥,必须先配置config/database.yml|config,先配置mysql
#rake generate_secret_token
bundle exec rake generate_secret_token


#创建数据库结构
RAILS_ENV=production bundle exec rake db:migrate
#生成缺省数据语言
RAILS_ENV=production bundle exec rake redmine:load_default_data

06、测试redmine


在WEBrick服务上测试Redmine是否安装成功
bundle exec rails server webrick -e production -b 0.0.0.0

http://IP:3000 (注意:打开iptables 3000端口号)
缺省管理员用户:
admin/admin

07、redmine运行在nginx


安装passenger
gem install passenger
rvmsudo passenger-install-nginx-module

//sudoer
vim /etc/sudoers
Defaults    secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/bin/env   //加上/usr/bin/env
usermod -G wheel ruby
echo erwsdfd123 |passwd ruby --stdin

/home/ruby/nginx
passenger-install-nginx-module可以选择自动下载完整nginx还是自己编译,我在这里是选了下载完整nginx

cp ../redmine-3.1.1 /usr/local/nginx/html/redmine
nginx.conf,修改server部分的location 为

        location / {
            root   html/redmine/public;
            index  index.html index.htm;
            passenger_enabled on;
        }
启动nginx
chmod -R 777 public   //开启访问权限
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

//nginx参考
1、gem install passenger
2、 passenger-install-nginx-modul
修改配置文件
user  redmine;
worker_processes  1;

http {
    passenger_root /usr/local/ruby/lib/ruby/gems/2.3.0/gems/passenger-5.0.30;
    passenger_ruby /usr/local/ruby/bin/ruby;
    passenger_app_env production;
    passenger_default_user redmine;
    passenger_user redmine;
  
    server {
        listen       80;
        server_name  localhost;
        passenger_enabled on;     

        location / {
           root   /app/redmine-3.3.1/public;
           #root html;
           index  index.html index.htm;
        }
  
#1024以下端口需要root 权限才能启动,必须以root 权限启动nginx

//plugin安装
bundle install --without development test postgresql sqlite --deployment
ruby bin/rake redmine:plugins RAILS_ENV=production

//邮件异步
1. 进入redmine目录下的config目录;
2. 编辑configuration.yml;
3. 找到 delivery_method: :smtp,将smtp改为async_smtp,保存退出;
4. 重启nginx服务;

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!