现在的位置: 首页Linux>正文
CentOS5.5平台搭建Redmine+SVN项目管理系统并整合到nginx [原创]
2011年06月24日 Linux 评论数 26 ⁄ 被围观 59,340 次+

Redmine:是一个基于web的项目管理软件,用Ruby开发的。是基于ROR框架开发的一套跨平台项目管理系统,是项目管理系统的后起之秀,据说是源于Basecamp的ror版而来,支持多种数据库,除了和DotProject的功能大致相当外,还有不少自己独特的功能,例如提供wiki、新闻台、时间跟踪、feed聚合、导出pdf等等,还可以集成其他版本管理系统和BUG跟踪系统,例如SVN、CVS、TD等等。配置功能强大而且方便,自定义属性和更新通知也很实用。下面我们来部署redmine+svn项目管理系统(需要严格的按照官方的安装文档安装对应的ruby包)

环境:CentOS-5.5 redmine-1.2.0 subversion-1.6.17

一、下载所需要软件包

  1. wget ftp://ftp.ruby-lang.org//pub/ruby/1.8/ruby-1.8.7.tar.gz
  2. wget http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz
  3. wget http://rubyforge.org/frs/download.php/74944/redmine-1.2.0.tar.gz
  4. wget http://subversion.tigris.org/downloads/subversion-1.6.17.tar.gz
  5. wget http://subversion.tigris.org/downloads/subversion-deps-1.6.17.tar.gz

二、先配置LNMP环境

参考:CentOS 5.5下安装mysql5.1.57+php5.2.17(FastCGI)+nginx1.0.1高性能Web服务器

三、redmine安装(对各软件包版本要求非常严格,必须对应相应版本,否则会出现不可预知的错误)

1、ruby安装:

  1. tar zxvf ruby-1.8.7.tar.gz
  2. cd ruby-1.8.7
  3. ./configure --prefix=/usr/local/ruby
  4. make && make install
  5. cd ..
  6. 修改~/.bash_profile,将ruby目录加入root环境变量
  7. 或者  echo "export PATH=$PATH:/usr/local/ruby/bin/" >> /etc/profile

2、rubygems 安装

安装rubygems ,注意一定要是1.7.0以下的版本,不然无法正常启动使用redmine。我就是因为看了一个他人写得中文文档,安装了1.7.0版本,所以redmine一直无法正常工作,为此走了一大圈弯路。最后在官方文档上才找到问题所在。下面是官网上的一些对版本要求的描述。
Ruby 1.9 is not supported yet. You have to use Ruby 1.8.x as stated above.
RubyGems 1.3.7 or higher is required with following limitations :
Rails 2.3.5 will fail with RubyGems 1.5.0 or later, stick to previous versions of RubyGems !
Rails 2.3.11 will fail with RubyGems 1.7.0 or later, stick to previous versions of RubyGems !
Rake 0.8.7 is required (rake 0.9.x is not supported by Rails yet)
Rack 1.1.x is required, 1.1.0 has a bug with quotes (#8416). Database migration would fail with other version.
Mongrel 1.1.5 needs a patch attached to #7688 to work fine with Rails 2.3.11. In case of upgrade, another issue may appear for some time after migration (#7857).
I18n 0.4.2 is required for Redmine >= 1.0.5

  1. tar zxvf rubygems-1.6.2.tgz
  2. cd rubygems-1.6.2
  3. ruby setup.rb
  4. cd ..

3、安装rails rack i18n mysql passenger

  1. gem install rails -v=2.3.11
  2. gem install rack -v=1.1.1
  3. gem install i18n -v=0.4.2
  4. gem install mysql --no-rdoc --no-ri -- --with-mysql-dir=/data/soft/mysql    #我的mysql是编译安装在/data/soft/mysql目录下的
  5. gem install passenger
  6. gem install mongrel mongrel_cluster

四、安装配置redmine

1、解压redmine

  1. tar zxvf redmine-1.2.0.tar.gz
  2. mv redmine-1.2.0 /data/www/redmine
  3. chown -R www. /data/www/redmine

2、建立数据库

  1. /data/soft/mysql/bin/mysql -uroot -p
  2. mysql> createdatabase redmine characterset utf8;
  3. mysql> grantallon redmine.* to 'redmine'@'localhost' identified by 'redmine';
  4. mysql> flush privileges;

3、修改redmine mysql数据库配置.

  1. cd /data/www/redmine/config
  2. cp database.yml.example database.yml
  3. vi database.yml
  4. production:
  5. adapter: mysql
  6. database: redmine
  7. host: localhost
  8. username: redmine
  9. password: redmine
  10. encoding: utf8

注意:冒号后面有一空格。。。

4、创建运行数据库:

生成会话存储密钥:

  1. cd /data/www/redmine
  2. rake generate_session_store

然后开始创建数据库表结构,在redmine的根目录下运行:

  1. RAILS_ENV=production rake db:migrate

读取默认配置数据,当遇到选择语言(Select language)时,选择zh:

  1. RAILS_ENV=production rake redmine:load_default_data

5、配置mongrel_cluster

  1. cd /data/www/redmine
  2. mongrel_rails cluster::configure -e production -p 8000 -a 127.0.0.1 -N 3

6、启用mongrel_cluster

  1. cd /data/www/redmine
  2. mongrel_rails cluster::start

启动如果出错如下:

  1. starting port 8000
  2. !!! Path to pid file not valid: tmp/pids/mongrel.8000.pid
  3. mongrel::start reported an error. Use mongrel_rails mongrel::start -h to get help.
  4. starting port 8001
  5. !!! Path to pid file not valid: tmp/pids/mongrel.8001.pid
  6. mongrel::start reported an error. Use mongrel_rails mongrel::start -h to get help.
  7. starting port 8002
  8. !!! Path to pid file not valid: tmp/pids/mongrel.8002.pid
  9. mongrel::start reported an error. Use mongrel_rails mongrel::start -h to get help.

创建/data/www/redmine/tmp/pids目录即可

  1. mkdir -p /data/www/redmine/tmp/pids

启动成功如下:

  1. [root@CentOS5 redmine]# mongrel_rails cluster::start
  2. starting port 8000
  3. starting port 8001
  4. starting port 8002

7、配置nginx

  1. vi /data/soft/nginx/conf/nginx.conf
  2. upstream mongrel
  3. {
  4. server 127.0.0.1:8000;
  5. server 127.0.0.1:8001;
  6. server 127.0.0.1:8002;
  7. }
  8. server
  9. {
  10. listen 80;
  11. server_name 192.168.8.32;
  12. root   /data/www/redmine;
  13. index   index.html index.htm;
  14. location /
  15. {
  16. proxy_pass http://mongrel;
  17. proxy_redirect off;
  18. proxy_set_header Host $host;
  19. proxy_set_header X-Real-IP $remote_addr;
  20. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  21. }
  22. }

五: 访问redmine测试:

  1. http://192.168.8.32

直接用ruby内置webrick也可启动redmine

  1. /usr/local/ruby/bin/ruby /data/www/redmine/script/server webrick -e production &

启动成功如下:

  1. [root@CentOS5 redmine]# /usr/local/ruby/bin/ruby /data/www/redmine/script/server webrick -e production &
  2. [1] 3526
  3. [root@CentOS5 redmine]# => Booting WEBrick
  4. => Rails 2.3.11 application starting on http://0.0.0.0:3000
  5. => Call with -d to detach
  6. => Ctrl-C to shutdown server
  7. [2011-06-2409:30:47] INFO  WEBrick 1.3.1
  8. [2011-06-2409:30:47] INFO  ruby 1.8.7 (2008-05-31) [i686-linux]
  9. [2011-06-2409:30:47] INFO  WEBrick::HTTPServer#start: pid=3526 port=3000

访问redmine测试: http://192.168.8.32:3000
六、配置SVN服务器
参考:CentOS下安装独立的SVN服务器
七、在redmine中配置svn
进入Redmine目录下Config,有文件“configuration.yml.example”,复制该文件重命名“configuration.yml”,修改其中的SVN配置

  1. scm_subversion_command: svn

注意:这里需要在环境变量PATH中添加svn所在的目录
再重启服务器,配置SCM
新建项目test,配置版本库 SCM-->选择Subversion
URL-->填写svn://192.168.8.32/test(根据自己svn配置自行修改)
登录名-->test(根据自己svn配置自行修改)
密码-->test(根据自己svn配置自行修改)
保存即可

本文地址:http://www.92csz.com/51/825.html
如非注明则为本站原创文章,欢迎转载。转载请注明转载自:moon's blog
 

目前有 26 条留言 其中:访客:17 条, 博主:9 条

  1. 知更鸟 : 2011年06月27日21:00:09  -49楼

    又来了,看上去也是个技术博客
    不过看了一下有点晕头晕脑,呵呵

    • clairelume : 2011年06月27日21:04:02

      呵呵,搞的有点乱,多谢鸟哥关注 😎

    • Kael.Z : 2011年06月28日20:10:45

      鸟哥,居然出现在这~ 😛

      • 知更鸟 : 2011年06月28日20:41:58

        发现很多站的读者墙前三位中都有你,呵呵

        • clairelume : 2011年06月29日10:48:35

          Kael.Z是位热心肠 😛

        • Kael.Z : 2011年06月29日12:26:11

          我只是会去各大博客转转,看看有什么新奇的东西~嘿

  2. 碎语人生 : 2011年06月28日21:55:49  -48楼

    过来学习了,谢谢楼主分享啦。

    • clairelume : 2011年06月28日21:57:08

      呵呵,共同学习!谢谢关注! 😛

  3. 碎语人生 : 2011年06月29日11:04:03  -47楼

    你什么时候加的友情链接我就不知道。呵呵 😀

    • clairelume : 2011年06月29日11:05:05

      一大早就加上了 🙄

  4. 软兔兔り : 2011年06月30日10:06:59  -46楼

    "\""" 这个主题更新后怎么显示出来呢

    • clairelume : 2011年06月30日10:17:22

      参考:http://www.92csz.com/26/570.html
      后台:当前主题设置–>其他功能模块设置–>是否显示顶部访客统计–>设置为Dispiay
      默认不显示

      • 软兔兔り : 2011年06月30日15:31:40

        再弱弱的问一句~ 您老人家的计数代码是什么 ~~ 我的这个代码 不重置 一直累计计数 也不归零了~! 蛋疼 😥

        • clairelume : 2011年06月30日15:47:53

          参考:http://www.92csz.com/26/570.html 里边有当天计数和累计计数的代码,我用的是最下面的是写入数据库的,解决了不定时自动重新计数的问题 😛

    • 淘宝网2011年热卖排行榜 : 2011年07月03日13:59:26

      楼主真强大高人啊学习了 🙂 🙂

      • clairelume : 2011年07月03日20:30:42

        过奖了!~ 😉

  5. Bob : 2011年07月01日22:06:38  -45楼

    好文…… :mrgreen:

    • clairelume : 2011年07月01日22:21:41

      多谢支持! 😛

  6. 小蒋 : 2011年07月14日23:03:08  -44楼

    东西是不错,可以没时间来整这个哦,只能等空了来研究下哈!

    • clairelume : 2011年07月16日12:06:31

      呵呵,我也是忙里偷闲写的,不够详细,先这样了,有空了在整理

  7. 笔记本无线网 : 2011年07月22日13:48:33  -43楼

    搜索了很多centos 下配置 SVN 的教程,博主这篇挺详细,我准备配置下试试。

  8. 常德SEO : 2011年08月12日09:27:19  -42楼

    进来学习哈!! 看得眼花缭乱,太深奥了 🙄

  9. 卢达 : 2011年12月04日01:04:52  -41楼

    以nginx反代理的形式,打开页面是空白,是不是还有其他需要注意的地方?

  10. 寒冰 : 2011年12月27日15:54:56  -40楼

    博主,你的博客做的不错啊,回头我也做一个

  11. 酷博 : 2012年02月01日11:44:26  -39楼

    哥们好像很久没更新了啊,加油啊

  12. 印度 : 2012年05月23日10:15:50  -38楼

    不错,比较喜欢技术类博客