导读 Redmine是一个免费开源的项目管理和问题跟踪应用程序,它是跨平台和跨数据库的,建立在Ruby on Rails框架之上。
实验环境

操作系统:Centos 8

应用:MariaDB + apache + Passenger + Ruby + Redmine

Redmine包括支持多个项目、wiki、问题跟踪系统、论坛、日历、邮件通知等;最近公司项目需要用到Redmine,所以记录下来了。

创建一个MySQL数据库

以root用户登录,执行交互操作

[root@linuxcool ~]# mysql
mysql> CREATE DATABASE redmine CHARACTER SET utf8;
mysql> GRANT ALL ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'password';
mysql> flush privileges;
mysql> exit;
更新dnf源
[root@linuxcool ~]# dnf install epel-release
[root@linuxcool ~]# dnf config-manager --enable epel
安装httpd
[root@linuxcool ~]# dnf install httpd
安装ruby
[root@linuxcool ~]# dnf install ruby
安装Passenger
[root@linuxcool ~]# dnf install mod_passenger passenger passenger-devel

设置apache开机启动
[root@linuxcool ~]# systemctl enable httpd
创建redmine系统用户
[root@linuxcool ~]# useradd -m -U -r -d /opt/redmine redmine
授权
[root@linuxcool ~]# usermod -a -G redmine apache
[root@linuxcool ~]# chmod 750 /opt/redmine
安装Redmine
[root@linuxcool ~]# dnf group install "Development Tools"
[root@linuxcool ~]# dnf install zlib-devel curl-devel openssl-devel mariadb-devel ruby-devel
下载Redmine安装包
[root@linuxcool ~]# curl -L http://www.redmine.org/releases/redmine-4.1.0.tar.gz -o redmine.tar.gz
[root@linuxcool ~]# tar -xvf redmine.tar.gz
配置Redmine
[root@linuxcool ~]# su - redmine
[root@linuxcool ~]# cp /opt/redmine/redmine-4.1.0/config/database.yml.example /opt/redmine/redmine-4.1.0/config/database.yml
[root@linuxcool ~]# vim /opt/redmine/redmine-4.1.0/config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "password"
  encoding: utf8mb4
安装Ruby dependencies插件
[root@linuxcool ~]# cd ~/redmine-4.1.0
[root@linuxcool ~]# gem install bundler --no-rdoc --no-ri
[root@linuxcool ~]# bundle install --without development test postgresql sqlite --path vendor/bundle
生成数据库密钥
[root@linuxcool ~]# bundle exec rake generate_secret_token
[root@linuxcool ~]# RAILS_ENV=production bundle exec rake db:migrate
配置apache虚拟主机
[root@linuxcool ~]# vim /etc/httpd/conf.d/redmine.conf
<VirtualHost *:80>
ServerName redmine.com
ServerAlias www.redmine.com
DocumentRoot /opt/redmine/redmine-4.1.0/public

<Directory /opt/redmine/redmine-4.1.0/public>
Options Indexes ExecCGI FollowSymLinks
Require all granted
AllowOverride all
</Directory>

ErrorLog /var/log/httpd/example.com-error.log
CustomLog /var/log/httpd/example.com-access.log combined
</VirtualHost>
重启httpd服务
[root@linuxcool ~]# systemctl restart httpd
测试Redmine

http://192.168.3.21

也可以通过http://www.redmine.com,但是需要修改hosts文件才可以,否则访问的是redmine官网。

本文原创地址:https://www.linuxprobe.com/centos-install-redmine.html编辑:向云艳,审核员:逄增宝