[2013-05-19]安装redmine1.4.0以上版本

2 篇文章 0 订阅
来自:http://www.redmine.org/projects/redmine/wiki/RedmineInstall

安装Redmine

这是 Redmine 1.4.0 及以上版本的安装文档. 1.3.x的安装文档请点击 这里.

要求

操作系统

Redmine 可以在安装有Ruby环境的大部分 Unix, Linux, Mac, Mac Server Windows 系统上运行. See specific installation HowTos here.

Ruby 环境

下面给出Redmine和Ruby的版本对应关系:

Redmine版本支援的Ruby版本相应的Rails版本支援的 RubyGems版本
当前主分支ruby 1.8.7, 1.9.2, 1.9.3, 2.0.01, jruby-1.6.7, jruby-1.7.2Rails 3.2.13RubyGems <= 1.8
2.3.0ruby 1.8.7, 1.9.2, 1.9.3, 2.0.01, jruby-1.6.7, jruby-1.7.2Rails 3.2.13RubyGems <= 1.8
2.2.4ruby 1.8.7, 1.9.2, 1.9.3, jruby-1.6.7Rails 3.2.13RubyGems <= 1.8

1  (3/19/2013)写道,有报告称Windowsruby 2.0.0和SQL Server支持 存在不兼容问题,原因是数据库gem适配器在此环境中包含一个bug MRI 1.9.3p327,会打断插件的载入。1.9.3p194 和 1.9.3p392 没有这个bug.

支援的后台数据库

  • MySQL 5.0 及更高版本
    • 确保为Ruby安装C扩展( C bindings) 能够极大地提高性能. 你可以通过执行gem install mysql2获得该套件.
  • PostgreSQL 8.2及更高版本
    • 确保你的数据库日期样式被设置为ISO (Postgresql 默认设置). 你可以通过这种方式设置:ALTER DATABASE "redmine_db" SET datestyle="ISO,MDY";
    • PostgreSQL 8.4.0 和 8.4.1拥有一些bug引起 Redmine 的行为 (#4259,#4314), 他们在 PostgreSQL 8.4.2被修复了
  • Microsoft SQL Server 2008 及更高版本 (从 Redmine 2.3.0开始)
  • SQLite 3 (不要使用多用户版本!)

可选组件

  • SCM binaries (eg. svn), for repository browsing (must be available in your PATH). SeeRedmineRepositories for SCM compatibility and requirements.
  • ImageMagick (to enable Gantt export to PNG image and thumbnails generation).
  • Ruby OpenID Library (to enable OpenID support). Version 2 or greater is required.

Redmine版本

建议大部分用户安装正式的point releases版的redmine. 当前Redmine每6个月放出一个新版本, 这些releases版本被认为有很好的可用性的稳定性. 不建议从trunk安装redmine, 除非你深入了解 Ruby on Rails 并且跟得上Trunk中随时不断发生的变更.

安装过程

步骤 1 - 获得Redmine 应用

通过下载打包的released版本或者从code repository中check out来获得Redmine的源代码.

这里 查看可下载的Redmine的详情.

步骤 2 - 创建一个空数据库并 accompanying user

此处,Redmine 将所使用的数据库用户命名为 redmine ,你可以使用其他数据库用户.

MySQL
CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

在5.0.2版本的MySQL之前,不需要 'create user' 步骤,可以用下面的语句完成:

GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'my_password';
PostgreSQL
CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
SQL Server

在SQL Server Management Studio中通过一些点击操作完成创建数据库、登入和用户等操作.

你也可以通过SQLCMD完成这些操作, 下面是一些基础示例:

步骤 3 - 数据库连接的配置

复制 config/database.yml.exampleconfig/database.yml 并编辑这个文件以便为"production"环境配置你的数据库设置.

以使用ruby 1.8或jruby时的MySQL数据库为例 :

production:
  adapter: mysql
  database: redmine
  host: localhost
  username: redmine
  password: my_password

以使用ruby 1.9时的MySQL数据库为例,适配器被设置为Mysql2 :

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: my_password

如果你的服务器不是用标准端口(3306), 请使用如下配置:

production:
  adapter: mysql
  database: redmine
  host: localhost
  port: 3307
  username: redmine
  password: my_password

以PostgreSQL数据库为例 (默认端口):

production:
  adapter: postgresql
  database: <你的数据库名>
  host: <你的数据库主机名>
  username: <你的数据库用户名>
  password: <你的数据库密码>
  encoding: utf8
  schema_search_path: <database_schema> (default - public)

以SQL Server数据库为例(默认主机名 localhost, 默认端口 1433):

production:
  adapter: sqlserver
  database: redmine
  username: redmine # 数据库用户名
  password: redminepassword # 数据库登录密码

步骤 4 - 依赖包的安装

Redmine 使用 Bundler 管理 gems 依赖包.

首先你需要安装bundler:

gem install bundler

然后你可以通过以下命令安装Redmine所需要的所有 gems:

bundle install --without development test
可选的依赖包
RMagick (允许使用ImageMagick为PDF和PNG导入提供图片操作)

如果不需要安装ImageMagick,  你需要通过以下命令实现:

bundle install --without development test rmagick

如果你在Windows下安装rmagick遇到问题, 请查看我该怎么办.

数据库适配器

Redmine通过读取config/database.yml来自动安装你的数据库所需要的适配器gems(eg. 如果你只配置了一个使用mysql2适配器的数据库链接, 将会只有mysql2 gem备案装).

config/database.yml中增改适配器之后,不要忘记重新运行一下bundle install --without development test

追加的依赖包 (Gemfile.local)

如果你需要载入Redmine core不需要的gems (例如. Puma, fcgi),在redmine根目录下创建一个名为Gemfile.local的文件. 他会在运行bundle install时自动加载gems.

例如:

# Gemfile.local
gem 'puma'

步骤 5 - Session加密存储的实现

这一步通过使用Rails生成的随机种子对cookies中存储的session数据进行了加密,杜绝了这些数据被非法篡改和使用.
在重启之后将重新产生新的随机种子,从而使已存在的session数据全部失效.

  • 在 Redmine 1.4.x版本中:
rake generate_session_store
  • 在 Redmine 2.x版本中:
rake generate_secret_token

步骤 6 - 数据库架构对象的创建

在应用的根目录下运行下面的命令行初见数据库架构:

RAILS_ENV=production rake db:migrate

Windows syntax:

set RAILS_ENV=production
rake db:migrate

这将会通过一个一个的运行所有的migrations来创建表然后创建权限集和名为admin的管理员帐号.

Ubuntu troubleshooting:

如果你在 Ubuntu中遇到如下错误:

Rake aborted!
no such file to load -- net/https

你需要安装libopenssl-ruby1.8,例如使用这样的方式: apt-get install libopenssl-ruby1.8.

步骤 7 -数据库默认数据集

通过运行下面的语句在数据库中插入基础数据:

RAILS_ENV=production rake redmine:load_default_data

Redmine 将会在加载时提示你设置数据语种; 你也可以通过以下命令预先设置REDMINE_LANG环境值,这样在载入时将会自动使用你的设置值并静默达成你的要求.

E.g.:

Unices:

RAILS_ENV=production REDMINE_LANG=fr rake redmine:load_default_data

Windows:

set RAILS_ENV=production
set REDMINE_LANG=fr
rake redmine:load_default_data

步骤 8 - 文件系统权限

NB: Windows用户可以跳过这一部分.

运行应用的用户账户必须在以下文件夹中拥有写权限:

  1. files (存储附件)
  2. log (应用的日志文件 production.log)
  3. tmptmp/pdf (如果没有请创建这些文件夹, 用于产生PDF文档以及其他文件)

以使用redmine用户帐号为例:

mkdir tmp tmp/pdf public/plugin_assets
sudo chown -R redmine:redmine files log tmp public/plugin_assets
sudo chmod -R 755 files log tmp public/plugin_assets

步骤 9 -安装测试

通过运行WEBrick web 服务器测试是否安装成功:

  • 在 Redmine 1.4.x版本中:
ruby script/server webrick -e production
  • 在 Redmine 2.x版本中:
ruby script/rails server webrick -e production

此时 WEBrick 已经启动, 用浏览器访问http://localhost:3000/. 现在你会看到应用的欢迎页面.

Note: Webrick is not suitable for production use, please only use webrick for testing that the installation up to this point is functional. Use one of the many other guides in this wiki to setup redmine to use either Passenger (akamod_rails), FCGI or a Rack server (Unicorn, Thin, Puma, hellip;) to serve up your redmine.

步骤 10 - 登录进入应用

使用默认的管理员帐号登录:

  • login: admin
  • password: admin

你可以在 Administration 菜单中选择 Settings 变更大部分应用设置.

配置

Redmine设置在 config/configuration.yml中进行定义.

If you need to override default application settings, simply copy config/configuration.yml.example toconfig/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).

重要 : 在任何更改之后要记得重启服务器.

Email / SMTP 服务器设置

dedicated page描述了Email配置.

SCM 设置

This configuration section allows you to:
  • override default commands names if the SCM binaries present in the PATH variable doesn't use the standard name (Windows .bat/.cmd names won't work)
  • specify the full path to the binary

以Subversion为例:

重写命令名:

scm_subversion_command: "svn_replacement.exe"

绝对路径:

scm_subversion_command: "C:\Program Files\Subversion\bin\svn.exe"

附件存储设置

你可以通过attachments_storage_path设置一个路径来存储Redmine附件,而不是使用Redmine实例默认使用的files目录.

例如:

attachments_storage_path: /var/redmine/files
attachments_storage_path: D:/redmine/files

配置日志

Redmine defaults to a log level of :info, writing to the log subdirectory. Depending on site usage, this can be a lot of data so to avoid the contents of the logfile growing without bound, consider rotating them, either through a system utility like logrotate or via the config/additional_environment.rb file.

To use the latter, copy config/additional_environment.rb.example toconfig/additional_environment.rb and add the following lines. Note that the new logger defaults to a high log level and hence has to be explicitly set toinfo.

#Logger.new(PATH,NUM_FILES_TO_ROTATE,FILE_SIZE)
config.logger = Logger.new('/path/to/logfile.log', 2, 1000000)
config.logger.level = Logger::INFO

备份

Redmine 备份应该包括:
  • 数据 (储存在你的redmine数据库)
  • 附件 (储存在你的Redmine安装目录中)

这是一个简单的 shell script 用来完成日备份,以使用mysql数据库为例:

# Database
/usr/bin/mysqldump -u <username> -p<password> <redmine_database> | gzip > /path/to/backup/db/redmine_`date +%y_%m_%d`.gz

# Attachments
rsync -a /path/to/redmine/files /path/to/backup/files

Linux/Unix的安装备注

Be sure to disable security hardenning tools during the installation process if you run into bizarre permission problems. These problems are mostly silent and can be caused by tools like extended ACLs, SELinux, or AppArmor. There tools are mostly used in big companies with a strict security policy, default Linux/Unix distributions settings shouldn't be a problem.

Windows的安装备注

There is an prebuilt installer of Ruby MRI available from http://rubyinstaller.org.
After installing it, select Start Command Prompt with Ruby in the start menu.

Specifying the RAILS_ENV environment variable:

When running command as described in this guide, you have to set the RAILS_ENV environment variable using a separate command.

I.e. commands with the following syntaxes:

RAILS_ENV=production <any commmand>
<any commmand> RAILS_ENV=production

have to be turned into 2 subsequent commands:

set RAILS_ENV=production
<any commmand>

MySQL gem installation issue:

You may need to manually install the mysql gem using the following command:

gem install mysql

And in some case it is required to copy the libmysql.dll file in your ruby/bin directory.
Not all libmysql.dll are ok this seem to works http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll.

Win7及以上版本的重要备注
On Win7 and later, localhost is commented out in the hosts file1 and IPV6 is the default2. As the mysql2 gem does no support IPV6 addresses3, a connection can't be established and you get the error "Can't connect to MySQL server on 'localhost' (10061)".
You can confirm this by pinging localhost, if ping targets "::1:" IPV6 is being used.

Workaround:
Replace localhost with 127.0.0.1 in database.yml.

1 http://serverfault.com/questions/4689/windows-7-localhost-name-resolution-is-handled-within-dns-itself-why

2 http://www.victor-ratajczyk.com/post/2012/02/25/mysql-fails-to-resolve-localhost-disable-ipv6-on-windows.aspx

3 https://github.com/brianmario/mysql2/issues/279

其他安装方式

一些用户可能更喜欢通过使用下载的第三方Redmine bundles 而不是手工安装.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值