前言:安装要求
Ruby解释器
给定Redmine版本所需的Ruby版本是:
Redmine版本 | 支持的Ruby版本 | 使用Rails版本 |
---|---|---|
4.0 | ruby 2.2(2.2.2及更高版本),2.3,2.4,2.5 | Rails 5.2 |
3.4 | 红宝石1.9.3 1,2.0.0,2.1,2.2,2.3,2.4 | Rails 4.2 |
3.3 | 红宝石1.9.3 1,2.0.0,2.1,2.2,2.3 | Rails 4.2 |
支持的数据库后端
MySQL 5.5 - 5.7 MySQL的5.6或更高版本和MariaDB的认识问题(#19344,#19395,#17460)。 Redmine 3.x还支持MySQL 5.0和5.1 PostgreSQL 9.2或更高版本 确保您的数据库日期样式设置为ISO(Postgresql默认设置)。您可以使用以下方式设置:ALTER DATABASE "redmine_db" SET datestyle="ISO,MDY"; Redmine 3.x还支持PostgreSQL 8.3 - 9.1。 Microsoft SQL Server 2012或更高版本 Redmine 4.0自2018年12月起不支持SQL Server,因为依赖库activerecord-sqlserver-adapter尚不支持Rails 5.2。 SQLite 3(不适用于多用户生产!)
可选组件
svn用于存储库浏览的SCM二进制文件(例如)(必须在PATH中可用)。有关SCM兼容性和要求,请参阅RedmineRepositories。
ImageMagick(使Gantt导出为PNG图像和缩略图生成)。
第1步、下载redmine应用软件(下载地址:http://www.redmine.org/projects/redmine/wiki/Download)
[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步、安装数据库,并为redmine创建一个空数据库和用户
[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步 、数据库连接配置
复制config/database.yml.example
到config/database.yml
和编辑这个文件,配置数据库"production"环境
[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
第5步 -生成会话存储秘密
[root@localhost config]# bundle exec rake generate_secret_token #生成Rails使用的随机密钥,用于编码存储会话数据的cookie,从而防止其被篡改。
生成新的机密令牌会在重新启动后使所有现有会话无效。将此秘密存储在config/secrets.yml中:http:
//guides.rubyonrails.org/upgrading_ruby_on_rails.html#config-secrets-yml
第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所以不需要设置,之所以用root用户是因为后面需要和httpd服务相结合发布redmine)
运行应用程序的用户帐户必须具有以下子目录的写入权限: files (附件存储) log(应用程序日志文件production.log) tmp和tmp/pdf(创建这些,如果不存在,用于生成PDF文档等) public/plugin_assets (插件的资产)
第9步 - 测试运行
[root@localhost config]# bundle exec rails server webrick -e production -b 192.168.1.110 #如果不指定地址默认为localhost
=> Booting WEBrick => Rails 4.2.11 application starting in production on http://192.168.1.110: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
第10步 -配置redmine
登录后可以转到"管理(Administration)"菜单,然后选择"设置(Settings)"以修改大多数应用程序设置
Redmine设置文件为config/configuration.yml
如果需要覆盖默认应用程序设置,只需复制config/configuration.yml.example
到config/configuration.yml
和编辑新的文件;
可以根据Rails环境(production
/ development
/ test
)定义这些设置。
重要 :不要忘记在任何更改后重新启动应用程序。
我们以邮件服务为例:
[root@localhost config]# cp configuration.yml.example configuration.yml [root@localhost config]# vim configuration.yml #以腾讯企业邮为例 default: email_delivery: delivery_method: :smtp smtp_settings: address: smtp.exmail.qq.com port: 25 domain: exmail.qq.com authentication: :login user_name: "admin@xxxx.com" password: "123456"
参考文档:
http://www.redmine.org/projects/redmine/wiki/RedmineInstall
http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade
https://docs.bitnami.com/installer/apps/redmine/administration/upgrade/
http://www.redmine.org/boards/2/topics/54308
https://blog.csdn.net/huoyunshen88/article/details/21241711