Centos7 安装redmine3.4

1 关闭防火墙,并下载安装包

[root@remind ~]# systemctl stop firewalld
[root@remind ~]# iptables -L -n
[root@remind ~]#wget https://www.redmine.org/releases/redmine-3.4.7.tar.gz
[root@remind ~]# tar xf redmine-3.4.7.tar.gz -C  /usr/local/
[root@localhost ~]# cd /usr/local/
[root@localhost local]# cd redmine-3.4.7/

2 安装数据库

[root@localhost redmine-3.4.7]# yum install mariadb-libs mariadb mariadb-devel mariadb-server -y
[root@localhost redmine-3.4.7]# systemctl start mariadb
[root@localhost redmine-3.4.7]# mysql
MariaDB [(none)]> CREATE DATABASE redmine CHARACTER SET utf8mb4;
Query OK, 1 row affected (0.01 sec)
MariaDB [(none)]> CREATE USER 'redmine'@'localhost' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> q

3 配置数据库连接

[root@localhost ~]# cd /usr/local/redmine-3.4.7/
[root@localhost redmine-3.4.7]# cd config
[root@localhost config]# cp configuration.yml.example  configuration.yml
[root@localhost config]# vim configuration.yml
[root@localhost config]# cp database.yml.example database.yml
[root@localhost config]# vim database.yml
...
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "123456"
...

4 安装依赖

[root@localhost config]#yum install ImageMagick-devel  ImageMagick  -y
[root@remind config]# yum -y install ruby rubygems ruby-devel
[root@remind config]# gem source -l 
[root@remind config]# gem sources -a http://mirrors.aliyun.com/rubygems/
http://mirrors.aliyun.com/rubygems/ added to sources
[root@remind config]# gem sources --remove  https://rubygems.org/
https://rubygems.org/ removed from sources
[root@remind config]# gem source -u 
source cache successfully updated
[root@remind config]# gem source -l  
*** CURRENT SOURCES ***

http://mirrors.aliyun.com/rubygems/
[root@remindconfig]# gem install bundler  #Redmine使用Bundler来管理gems依赖项,需要先安装Bundler
[root@remind config]# bundle install --without development test  production  #安装Redmine所需的所有gem

bundle install 出现下图错误,可替换gemfile文件,https://www.redmine.org/projects/redmine/repository/revisions/18635

5  生成会话存储 密码

[root@localhost config]# bundle exec rake generate_secret_token

6 创建数据库模式对象

[root@localhost config]# RAILS_ENV=production bundle exec rake db:migrate 
这一步有一个bug(Mysql2::Error: Specified key was too long; max key length is 767 bytes: CREATE UNIQUE INDEX `changesets_repos_rev.....),如下图

解决:在 redmine/config/initializers/下添加mysqlpls.rb脚本,脚本内容如下

复制代码
[root@localhost config]# cd initializers/
[root@localhost initializers]# cat mysqlpls.rb 
require 'active_record/connection_adapters/abstract_mysql_adapter'

module ActiveRecord
  module ConnectionAdapters
    class AbstractMysqlAdapter
      NATIVE_DATABASE_TYPES[:string] = { :name => "varchar", :limit => 191 }
    end
  end
end
[root@localhost config]# RAILS_ENV=production bundle exec rake db:migrate 

7 数据库默认数据集

[root@localhost config]# RAILS_ENV=production bundle exec rake redmine:load_default_data #在数据库中插入默认配置数据
(in /usr/local/redmine-3.4.7)

Select language: ar, az, bg, bs, ca, cs, da, de, el, en, en-GB, es, es-PA, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] zh
====================================
Default configuration data loaded.

8 测试运行

  

[root@localhost config]# bundle exec rails server webrick -e production -b 0.0.0.0  #如果不指定地址默认为localhost
=> Booting WEBrick
=> Rails 4.2.11 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2018-12-25 15:35:03] INFO  WEBrick 1.3.1
[2018-12-25 15:35:03] INFO  ruby 2.0.0 (2015-12-16) [x86_64-linux]
[2018-12-25 15:35:03] INFO  WEBrick::HTTPServer#start: pid=17484 port=3000

访问redmine,登录账号密码为admin:admin

参考链接:https://www.cnblogs.com/panwenbin-logs/p/10174525.html




 




move on
原文地址:https://www.cnblogs.com/amy720/p/13755134.html