CentOS 部署配置 Redmine

安装 Ruby 2.4

1
2
3
4
5
6
7
8
9
10
11
yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison ImageMagick-devel  ImageMagick
yum -y install centos-release-scl-rh
yum -y install rh-ruby24
scl enable rh-ruby24 bash
ruby -v
yum -y install rh-ruby24-rubygems rh-ruby24-ruby-devel
gem source -l
gem sources -a http://mirrors.aliyun.com/rubygems/
gem sources --remove https://rubygems.org/
gem source -u
gem source -l

设置数据库

建立相应数据库

1
2
3
4
mysql> create user 'redmine'@'%' identified by '123456' ;
mysql> create database redmine;
mysql> grant all on redmine.* to 'redmine'@'%';
mysql> flush privileges;

安装 redmine

1
2
3
4
5
6
7
8
cd /usr/local
wget https://www.redmine.org/releases/redmine-4.0.4.tar.gz
tar zxvf redmine-4.0.4.tar.gz
mv redmine-4.0.4 redmine
echo "export REDMINE=/usr/local/redmine" >> /etc/profile
source /etc/profile
cd $REDMINE
cp config/database.yml.example config/database.yml

配置 redmine,修改 $REDMINE/config/database.yml

1
2
3
4
5
6
7
production:
adapter: mysql2
database: redmine
host: localhost
port: 3306
username: redmine
password: "123456"

安装 GEMS 依赖

1
2
3
cd $REDMINE
gem install bundler
bundle install --without development test production

生成会话存储秘钥令牌

1
bundle exec rake generate_secret_token

生成数据库结构

1
RAILS_ENV=production REDMINE_LANG=zh bundle exec rake db:migrate

数据库插入默认数据

1
RAILS_ENV=production REDMINE_LANG=zh bundle exec rake redmine:load_default_data

启动 redmine

1
bundle exec rails server webrick -e production -b 127.0.0.1

配置 LDAP 认证

依次打开 管理 -> LDAP 认证 -> 新建认证模式

配置一个 ou=admin 的配置如下:

同样的方法配置所需要的所有 ou,如下图所示:

配置 CAS SSO

安装插件

1
2
3
4
5
6
7
8
cd $REDMINE/plugins
git clone https://github.com/athlonreg/redmine_omniauth_cas
cd redmine_omniauth_cas
bundle install
cd $REDMINE
bundle install
RAILS_ENV=production rake redmine:plugins
bundle exec rails server webrick -e production -b 127.0.0.1

依次打开 管理 -> 插件,点击插件 Redmine Omniauth plugin 后的配置

配置如下:

各字段含义对照表

字段名称字段含义
Enable CAS authentication是否启用 CAS 认证
CAS server URLCAS 服务器地址
CAS validation URL (if different)CAS 服务器身份验证接口地址
Login page text登陆页面标题
Replace Redmine login page是否使用 CAS 服务器的登陆界面替换插件提供的登录界面
-------------本文结束感谢您的阅读-------------
请站长喝杯咖啡吧´◡`