三颗纽扣

世界上最宽广的是海洋,比海洋更宽广的是天空,比天空更宽广的是人的胸怀

导航

windows下安装redmine-2.1

如果只是玩玩,采用 BitNami 安装包应该是最简单直接的方式,不过实际部署到生产环境,服务器上已经安装有 xampp,所以记录一下 手工安装的过程。其实基本步骤和官方文档完全是一样的,贡献给不喜欢英文的朋友们吧。

== 安装 Ruby ==

这里选择的 Ruby 1.9.3,试过 Ruby 1.8.7 但是确实性能比 1.9.3 要差很多。下载地址 http://cdn.rubyinstaller.org/archives/1.9.3-p327/ruby-1.9.3-p327-i386-mingw32.7z

没试过 MSI 安装包,不过个人比较喜欢这种解压即用的方式。

解压到 c:\ruby-1.9.3,然后将 c:\ruby-1.9.2\bin 加入到 path 环境变量中去。

== 安装 Redmine ==

现在最新版是Redmine 2.1,通过 SVN 下载,在 C:\ 根目录下运行,

svn co http://svn.redmine.org/redmine/branches/2.1-stable redmine-2.1

会把 redmine 下载到 c:\redmine-2.1 目录下

== 安装 DevKit ==

下载地址 http://cloud.github.com/downloads/oneclick/rubyinstaller/DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe

这是个自解压包,不过也可以用解压工具直接解压到 c:\devkit

解压完成后进行以下配置:

cd /d c:\devkit
ruby dk.rb init

将生成 c:\devkit\config.yml 文件,但这个文件需要手工编辑

notepad c:\devkit\config.xml

将文件内容修改为

# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- c:/ruby-1.9.3

然后执行命令

ruby dk.rb install

== 安装依赖包及配置等等 ==

在命令行,执行

gem install bundler

这个会联机下载依赖包,需要一段时间

进入 redmine-2.1 目录,即

cd /d c:\redmine-2.1
bundle install --without development test rmagick postgresql sqlite

在 redmine-2.1 目录下新建一个文件 Gemfile.local

notepad c:\redmine-2.1\Gemfile.local

文件内容为:

# Gemfile.local
gem 'thin'

进入 Mysql 客户端命令行

mysql -u root -p

创建 redmine 用户及数据库,注意修改 my_password 为实际的密码

create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'my_password';
grant all privileges on redmine.* to 'redmine'@'localhost';

修改 C:\redmine-2.1\config\database.yml 配置文件

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

更新 libmysql.dll, 下载 http://cdn.mysql.com/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip

将压缩包中的 lib\libmysql.dll 文件提取出来并拷贝到 c:\ruby-1.9.3\bin 目录下

执行命令

rake generate_secret_token

执行命令

set RAILS_ENV=production
rake db:migrate
set RAILS_ENV=production
set REDMINE_LANG=zh
rake redmine:load_default_data

至此,安装配置过程基本完成,执行以下命令测试看看安装是否成功

ruby script/rails server webrick -e production

等到 提示说已经在 3000 端口监听后,打开网址 http://localhost:3000/ 看看是否可以显示 redmine 欢迎页面,如果有,说明安装成功了。按 CTRL-C 终止这个服务。

== 配置 Apache 反向代理 ==

修改 C:\redmine-2.1\config\environment.rb 配置文件,在文件最后添加一行

Redmine::Utils::relative_url_root = "/redmine" 

修改 apache httpd.conf 配置文件,在文件最后添加

ProxyRequests Off
#No need to forward on static content - let apache do it faster
ProxyPass /redmine/images !
ProxyPass /redmine/stylesheets !
ProxyPass /redmine/javascript !
# Remove the following entry on public sites as this is insecure
ProxyPass /redmine/plugin_assets !
ProxyPass /redmine/help !
ProxyPass /redmine http://localhost:3000/redmine
ProxyPassReverse /redmine http://localhost:3000/redmine
ProxyPreserveHost On
#continue with other static files that should be served by apache
Alias /redmine/images C:/redmine-2.1/public/images/
Alias /redmine/stylesheets C:/redmine-2.1/public/stylesheets/
Alias /redmine/javascript C:/redmine-2.1/public/javascript/
# Remove the following on public sites as this is insecure
Alias /redmine/plugin_assets C:/redmine-2.1/public/plugin_assets/
Alias /redmine/help C:/redmine-2.1/public/help/

# Make sure apache can see public and all subfolders - not suitable for public sites
<Directory "C:/redmine-2.1/public/">
    Allow from all
    Order allow,deny
</Directory>

最后,通过 thin 启动 redmine 服务,在 c:\redmine-2.1 目录下,执行命令

thin start --prefix /redmine -e production

等待出现 >> Listening on 0.0.0.0:3000, CTRL+C to stop 提示时,访问网址 http://localhost/redmine 如果出现 redmine 的欢迎页面,则大功告成。


最后,采用 HTTPS 访问 SVN 库,通常由于 证书 不被信任,所以需要在服务器上运行一次 svn 命令

svn list https://wellcommsoft.com/svn/wellcomm.common/trunk/src/Wellcomm.Commons/Wellcomm.Commons/

这时会提示证书不被信任,选择 p 永远接收,以后 redmine 就可以访问 SVN 仓库了。

posted on 2012-11-13 09:57  三颗纽扣  阅读(756)  评论(0编辑  收藏  举报