Redmine安装文档

xiaoxiao2021-02-28  40

Redmine安装文档

环境:win10x64,Redmine-3.4.5,以下操作都是在没有翻墙的情况下执行的

以下命令大多是在RedMine项目根目录进行运行

1.安装rubyinstaller-devkit-2.4.4-1-x64.exe

下载地址:https://github-production-release-asset-2e65be.s3.amazonaws.com/78153411/7d4c46da-3361-11e8-9a54-4786b55e58c2?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A/20180502/us-east-1/s3/aws4_request&X-Amz-Date=20180502T080022Z&X-Amz-Expires=300&X-Amz-Signature=e2ae360f0da74bec90968ee4365f5054b254a8e34815e14eb8c23fcdacbacc4d&X-Amz-SignedHeaders=host&actor_id=0&response-content-disposition=attachment; filename=rubyinstaller-devkit-2.4.4-1-x64.exe&response-content-type=application/octet-stream

运行安装里的选项如(utf-8)都选上

最后安装完之后弹出命令窗口,选择3,然后等待安装完成

2.gem 升级

gem update --system # 可能需要翻墙 gem -v 2.7.6

如果没有翻墙的话可能会提示

Error:While executing gem …

time out https://api.rubygems.org/specs.4.8.gz

替换下载地址,命令如下

$ gem sources --add http://gems.ruby-china.org/ --remove https://rubygems.org/ $ gem sources ##-l 执行显示的是新的地址

3.安装Redmine支持的最高Rails 版本4.2:

gem install rails -v 4.2.5

执行结果如下:

4.执行创建数据库命令

USE [master] GO -- Very basic DB creation CREATE DATABASE [REDMINE] GO -- Creation of a login with SQL Server login/password authentication and no password expiration policy CREATE LOGIN [REDMINE] WITH PASSWORD=N'password', DEFAULT_DATABASE=[REDMINE], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF GO -- User creation using previously created login authentication USE [REDMINE] GO CREATE USER [REDMINE] FOR LOGIN [REDMINE] GO -- User permissions set via roles EXEC sp_addrolemember N'db_datareader', N'REDMINE' GO EXEC sp_addrolemember N'db_datawriter', N'REDMINE' GO EXEC sp_addrolemember N'db_owner', N'REDMINE' -- 不加这个,后面会没有权限创建表 GO

5.数据库连接和配置

修改config/database.yml

production: adapter: sqlserver database: redmine host:服务器名称如 localhost username: redmine # 登录名 password: password # 密码 encoding: utf8

6.安装依赖项(需要安装版本6.9的)

下载ImageMagick-7.0.7-28-Q16-x64-dll.exe

下载地址:https://www.imagemagick.org/download/binaries/ImageMagick-7.0.7-28-Q16-x64-dll.exe

安装时需要选择,如下:

安装完成后台, 请在命令行执行下面命令:

set CPATH="C:\Program Files\ImageMagick-6.9.9-Q16\include" set LIBRARY_PATH="C:\Program Files\ImageMagick-6.9.9-Q16\lib" gem install bundle

error:Could not find gem ‘rails <=4.2.8> x64-mingw32’ in any of the gem sources listed in your Gemfile.

Run ‘bundle install’ to install missing gems.

执行命令 bundle install

提示错误, Make sure that gem install rmagick -v ‘2.16.0’

执行命令 gem install rmagick -v '2.16.0' 报错: ErrorError installing rmagick: Error:Failed to build gem native extension.

解决办法

将文件rmagick-2.16.0.gem下载到本地后,复制到目录C:\Ruby25-x64

执行命令gem install --local rmagick-2.16.0.gem,结果如下

然后,您可以使用以下命令安装Redmine所需的所有Gem

bundle install --without development test

生成对话存储加密

bundle exec rake generate_secret_token

执行错误:

LoadError:cannot load such file – tiny_tds/tiny_tds

解决办法:

错误解决: 更改tiny_tds 的版本为最新,更改文件:Gemfile(目录:Redmine项目根目录) when /sqlserver/ gem "tiny_tds", (RUBY_VERSION >= "2.0" ? "~> 1.0.5" : "~> 0.7.0"), :platforms => [:mri, :mingw, :x64_mingw] gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw, :x64_mingw]

改为

when /sqlserver/ gem "tiny_tds", (RUBY_VERSION >= "2.0" ? "~> 2.1.1" : "~> 0.7.0"), :platforms => [:mri, :mingw, :x64_mingw] gem "activerecord-sqlserver-adapter", :platforms => [:mri, :mingw, :x64_mingw]

然后再执行命令bundle exec rake generate_secret_token,结果如下

根据提示我们执行命令 bundle install,

提示安装成功,如果不是结果如下

运行命令gem install tiny_tds -v '2.1.1',结果提示

提示结果是tiny_tds版本不支持当前的环境(Ruby ),那我们将就需要降低ruby的版本,如将2.5降低为2.4

7.创建数据库表

Database schema objects creation

set RAILS_ENV=production bundle exec rake db:migrate
错误:

Could not locate Gemfile or .bundle/ directory,这是由于不是在redmine项目根目录运行导致的

TinyTds::Error:Server name not found in configuration files,在config/database.yml下的Production里的host的值有特殊符号可能会引起这个问题,如 DespTop\Sql2008

错误:cannot load such file – tiny_tds/tiny_tds

C:\www\redmine>bundle exec rake db:migrate rake aborted! LoadError: cannot load such file -- tiny_tds/tiny_tds C:/www/redmine/config/application.rb:5:in `<top (required)>' C:/www/redmine/Rakefile:5:in `require' C:/www/redmine/Rakefile:5:in `<top (required)>' Caused by: LoadError: cannot load such file -- tiny_tds/2.5/tiny_tds C:/www/redmine/config/application.rb:5:in `<top (required)>' C:/www/redmine/Rakefile:5:in `require' C:/www/redmine/Rakefile:5:in `<top (required)>' (See full trace by running task with --trace)

TinyTds::Error:unable to connect:Adaptive Server is unavailable or does not exist<>

解决办法:

在SQL Server 中启用1433 端口。Sql Server Configuration Manager(SQL Server 配置管理器)

SQL Server网络配置->MSSQLSERVER 的协议->TCO/IP ,右键启动

重启服务:SQL Server 服务 - ->SQL Server (MSSQLSERVER)右键停止然后启动

在执行出错命令bundle exec rake db:migrate结果如下:

如上图还是有错误那我们再次运行这个命令,就会发现没有错误信息了

8.数据库默认数据集

Insert default configuration data in database, by running the following command:

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

执行结果:

Default configuration data loaded.

9.测试安装是否成功(redmine启动命令)

with Redmine 3.x:

bundle exec rails server webrick -e production

结果如下(执行需要一段时间,请耐心等待执行完成):

图片:测试安装是否成功结果

=> Booting WEBrick => Rails 4.2.8 application starting in production on http://loaclhost:3000 => Run 'rails server -h' for more startup options => Ctrl-C to shutdown server [2018-04-28 11:26:11] INFO WEBrick 1.4.2 [2018-04-28 11:26:11] INFO ruby 2.5.1 (2018-03-29) [x64-mingw32] [2018-04-28 11:26:11] INFO WEBrick::HTTPServer#start: pid=5676 port=3000

执行完成后就可以在浏览器上访问,http://loaclhost:3000

10.配置configuraton.yml

在根目录/config里复制configuration.yml.example文件,然后重命名为configuraton.yml

Redmine settings are defined in a file named config/configuration.yml.

If you need to override default application settings, simply copy config/configuration.yml.example to config/configuration.yml and edit the new file; the file is well commented by itself, so you should have a look at it.

These settings may be defined per Rails environment (production/development/test).

Important : don’t forget to restart the application after any change.

将Redmine作为Windows 服务启动

原因是运行redmine 需要执行命令,才可以访问,但如果作为一个服务就不需要每次重启电脑后我们手动执行命令来让Redmine正常运行了。

参考地址:

http://www.redmine.org/projects/redmine/wiki/HowTo_run_Redmine_as_a_Windows_service_(win32-service_+_taskill_approach)

在Redmine根目录创建一个 service.rb的文件

文件内容:

REDMINE_DIR = 'C:\www\redmine-3.4.5' LOG_FILE = "#{REDMINE_DIR}\\log\\service.log" begin require 'win32/daemon' include Win32 class RedmineService < Daemon def service_init File.open(LOG_FILE, 'a'){ |f| f.puts "Initializing service #{Time.now}" } #@server_pid = Process.spawn 'ruby script/rails s -e production', :chdir => REDMINE_DIR, :err => [LOG_FILE, 'a'] @server_pid = Process.spawn 'C:\Ruby24-x64\bin\ruby C:\www\redmine-3.4.5\bin\rails s -e production -p 3000 -b 192.168.1.130', :chdir => REDMINE_DIR, :err => [LOG_FILE, 'a'] end def service_main File.open(LOG_FILE, 'a'){ |f| f.puts "Service is running #{Time.now} with pid #{@server_pid}" } while running? sleep 10 end end def service_stop File.open(LOG_FILE, 'a'){ |f| f.puts "Stopping server thread #{Time.now}" } system "taskkill /PID #{@server_pid} /T /F" Process.waitall File.open(LOG_FILE, 'a'){ |f| f.puts "Service stopped #{Time.now}" } exit! end end RedmineService.mainloop rescue Exception => e File.open(LOG_FILE,'a+'){ |f| f.puts " ***Daemon failure #{Time.now} exception=#{e.inspect}\n#{e.backtrace.join($/)}" } raise end 执行命令安装包 gem install win32-service

创建Redmine启动服务

sc create redmine binPath= "D:\Ruby24-x64\bin\rubyw -C C:\redmine-3.4.5\ service.rb"

创建好之后在服务中将Redmine服务改成自动启动,重启电脑后发现服务没有启动起来(手动能够启动),可能与Ruby启动有关。

11.redmine的访问地址可以通过service.rb来配置,需要修改如下代码

只能本地访问 @server_pid = Process.spawn 'C:\Ruby24-x64\bin\ruby C:\www\redmine-3.4.5\bin\rails s -e production -p 3000', :chdir => REDMINE_DIR, :err => [LOG_FILE, 'a'] 可以局域网内访问 @server_pid = Process.spawn 'C:\Ruby25-x64\bin\ruby C:\www\redmine-3.4.5\bin\rails s -e production -p 3000 -b 192.168.1.130', :chdir => REDMINE_DIR, :err => [LOG_FILE, 'a']

#### 12.配置邮件

参考地址:

https://yq.aliyun.com/articles/5332

http://www.redmine.org/projects/redmine/wiki/EmailConfiguration

在项目根目录/config下添加一个configuration.yml文件

修改如下代码:

# = Redmine configuration file # # Each environment has it's own configuration options. If you are only # running in production, only the production block needs to be configured. # Environment specific configuration options override the default ones. # # Note that this file needs to be a valid YAML file. # DO NOT USE TABS! Use 2 spaces instead of tabs for identation. # default configuration options for all environments default: # Outgoing emails configuration # See the examples below and the Rails guide for more configuration options: # http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration # email_delivery: # ==== Simple SMTP server at localhost # # email_delivery: # delivery_method: :smtp # smtp_settings: # address: "localhost" # port: 25 # # ==== SMTP server at example.com using LOGIN authentication and checking HELO for foo.com # 配置邮箱需要的代码 email_delivery: delivery_method: :smtp smtp_settings: address: "smtp.mxhichina.com" port: 25 authentication: :login domain: 'mxhichina.com' user_name: 'xxxxxx@company.com' password: 'password'

然后重新启动 redmine 服务.

测试是否配置成功:

打开Redmine >管理员登陆 > 管理 > 配置 > 邮件通知 >页面底部:发送测试邮件。将会发送邮件到你目前登陆的用户邮箱中。

如果没有配置成功,则这个选项卡显示的是黄色的字,如未对邮件进行配置,config/configuration.yml。

redmine项目升级指南

参考:http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade

数据转移、redmine从3.2升级到3.4

执行步骤(在redmine根目录执行)

1、添加redmine数据库(未升级前的数据库)

在新的服务器里数据库中还原备份好的.bak文件,如数据库命名为redmine_first

2、修改数据库的配置文件(database.yml)

改成新添加的数据库redmine_first(旧的redmine使用的数据库备份文件还原好的数据库)

3、生成新的密钥:

bundle exec rake generate_secret_token

4、更新数据库 这一步可以改变你的数据库的内容。转到您的新redmine目录,然后迁移您的数据库:

bundle exec rake db:migrate RAILS_ENV = production 如果你已经安装了任何插件,你还应该运行他们的数据库迁移:

bundle exec rake redmine:plugins:migrate RAILS_ENV = production

5、清除缓存和现有会话:

bundle exec rake tmp:cache:clear tmp:sessions:clear RAILS_ENV = production

6.重新启动应用程序服务器。

转载请注明原文地址: https://www.6miu.com/read-2692472.html

最新回复(0)