转载自:http://blog.sina.com.cn/s/blog_5007d1b10100qmnk.html
由于项目需要,需要使用RedMine。
而RedMine在linux搭建教容易,同时,在windows2003下(不使用IIS)也教容易搭建,具体的安装步骤,可以参考官方网址
http://www.redmine.org/projects/redmine/wiki/RedmineInstall
我们搭建redmine使用集成环境Instantails。而Instantails官网这个程序最新的2.0版本07年以后就不再更新了,因此自己搭建前请根据自己的需求而选择。而自身选择集成,是因为教简单,配置方便。
下载最新的InstantRails2.0:
http://rubyforge.org/projects/instantrails/
最新版的redmine 1.1.2:
http://rubyforge.org/frs/?group_id=1850
gem1.3.7版:
http://rubyforge.org/frs/download.php/70695/rubygems-update-1.3.7.gem
以下是配置InstantRails2.0与redmine的步骤,仅供参考:
1、解压InstantRails2.0到一个文件夹,文件夹名字不能含有空格(如InstantRails即可)。
2、然后把redmine 1.1.2解压到InstantRails下的rails_apps下。
注:这个就是ruby的项目文件夹。
3、把redmine的数据库建立起来
- 进入“InstantRails/rails_apps/redmine/config"下,有文件“database.yml.example”,复制该文件重命名“database.yml”。
注:这个是redmine数据库的配置文件,里面有数据库的相关信息。
- 进入InstantRails根目录下。点击InstantRails.exe文件。此时启动环境(Apache)的主程序了。
- InstantRails界面(就是刚点击 InstantRails.exe后的程序界面)的I→Configure→Database (via PhpMyAdmin)”。
进入phpMyAdmin下,新建三个数据库(用sql命令方式):
create database redmine character set utf8;
create database redmine_development character set utf8;
create database redmine_test character set utf8;
4、创建数据库
点击InstantRails界面(就是刚点击InstantRails.exe后的程序界面)的I→Rails Applications→Open Ruby Console Window栏目,然后会跳出dos窗口。在里面输入命令:
-
cd redmine //进入redmin目录
-
rake db:migrate RAILS_ENV="production" //创建数据库
注:此时会出现问题,提示gem版本过低,错误如下:
Missing the i18n 0.4.2 gem. Please `gem install -v=0.4.2 i18n`
解决方法如下(如不行就在当前窗口下执行如下):
1.重新打开一个DOS窗口(如新DOS窗口提示不可以运行gem,则在上面的DOS窗口中通过cd进入下载gem1.3.7的目录下)
2.DOS窗口里用命令进入gem1.3.7文件所在的目录,执行gem install --local rubygems-update-1.3.7.gem,出现信息:
Successfully installed rubygems-update-1.3.7
1 gem installed
Installing ri documentation for rubygems-update-1.3.7...
Installing RDoc documentation for rubygems-update-1.3.7...
Could not find main page README
Could not find main page README
Could not find main page README
Could not find main page README
3. 再执行update_rubygems.会出现的信息很多,等结束完了运行gem -v 发现已经升级到了1.3.7 yeah
4.执行gem install rack -v=1.0.1
5.gem install -v=2.3.5 rails
6.gem install -v=0.4.2 i18n
注:到此为止,基本环境基本搞定。
5、继续回到Open Ruby Console Window栏目(仍然回到redmine目录下),跳出的dos窗口下,运行以下命令
-
gem install -v=0.4.2 i18n
-
rake db:migrate RAILS_ENV="production"
注:运行rake db:migrate RAILS_ENV="production"可能会报如下错误:
A key is required to write a cookie containing the session data. Use config.acti
on_controller.session = { :key => "_myapp_session", :secret => "some secret phra
se" } in config/environment.rb
解决方法:
进入redmine下,打开config/environment.rb,在该文件末尾加上如下内容:
config.action_controller.session = { :key => "_myapp_session", :secret => "4035ba51531c6c96a27e3dd41e3d4471" },保存重新执行rake db:migrate RAILS_ENV="production",则可以看到安装了多个表
imports data
cd remine
rake db:migrate RAILS_ENV="development"
rake load_default_data RAILS_ENV="development"
if you see error like:
Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RA
ILS_GEM_VERSION setting in config/environment.rb for the Rails version you do ha
ve installed, or comment out RAILS_GEM_VERSION to use the latest version install
ed.
you need to modify enviroment.rb as
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.3' unless defined? RAILS_GEM_VERSION
if you see error like:
"A key is required to write a cookie containing the session data. Use config.action_controller.session = {:key => "_myapp_session", :secret => "some secret phrase"} in config/environment.rb"
please do as the suggestion, add following config to enviroment.rb file:
config.action_controller.session = { :key => "_redmine_session", :secret => "aa3be4f950045ce76451b8197bf06b6d" }
-
rake redmine:load_default_data RAILS_ENV="production" //指明当前项目运行环境为production ,中间会提示选择语言,选择zh(中文)。
继续安装数据库
-
rake db:migrate RAILS_ENV="development"
-
rake redmine:load_default_data RAILS_ENV="development"
到此配置结束了,点击InstantRails界面(就是刚点击InstantRails.exe后的程序界面)的I→Rails Applications→Manage Rails Applications栏目,如下,点击“Start with Mongrel”(启动redmine这个应用程序)。跳出一个dos窗口,不要关闭。现在就可以浏览你配置好的RedMine了。(如果出现没有绑定什么的提示具体的提示内容忘掉了,说明需要添加MySQL的动态链接库文件 libmySQL.dll)
libmySQL.dll下载地址:
http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll
把libmySQL.dll复制到 Instantails/Ruby/bin/目录下(你安装rubyinstaller的目录Instantails)
基本上到此就OK了。
如想修改redmine的端口(默认需要http://localhost:3000方可访问)
-
在I→configure→Apache 打开配置文件,搜索文件,将80的地方通通改为8080(其实就两个地方)。
-
在I→Rails Applications→Manage Rails Applications里,选中redmine,然后点击有个configure startup mode里,将端口配置为80。
-
然后点Start with Mongrel,在浏览器中输入http://localhost则可以看到redmine首页。
-
用户名:admin 密码:admin
-
可以看到成功登陆后台
本文详细介绍了如何在Windows上使用InstantRails 2.0搭建Redmine。首先,下载并解压所需软件,然后配置数据库,创建redmine_development和redmine_test数据库。接着,解决gem版本问题,安装必要组件,并进行数据库迁移。在遇到错误时,修改环境配置文件以解决问题。最后,启动应用程序,通过http://localhost:3000访问Redmine,初始用户名和密码为admin/admin。

1万+

被折叠的 条评论
为什么被折叠?



