目录

在ubuntu上部署Redmine 2.5.2

1. 安装Ruby

sudo apt-get install ruby rubygems

2. 检查ruby的版本

$ ruby -v

ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

$ gem -v

1.8.15

3. 安装bundler

由于国内防火墙的原因, ruby的官网无法连接,因此需更改source到taobao的镜像网站上。

$ gem sources –remove https://rubygems.org/

$ gem sources -a http://ruby.taobao.org/

$ gem sources -l

* CURRENT SOURCES *

http://ruby.taobao.org

$ gem install bundler

4. 下载Redmine V.2.5.2

$ wget http://www.redmine.org/releases/redmine-2.5.2.tar.gz

$ tar zxvf redmine-2.5.2.tar.gz -C /opt

5. 安装需要的gems, --without 后面的参数表示排除的gems

(注:ruby gem Pg is the Ruby interface to the {PostgreSQL RDBMS})

$ cd /opt/redmine-2.5.2

$ vi Gemfile

将源更改为国内taobao镜像

source 'http://ruby.taobao.org'

$ bundle install –without test postgresql sqlite rmagick

Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

6.准备配置文件:

$ apt-get install redmine-mysql

$ cp config/configuration.yml.example config/configuration.yml

$ cp config/database.yml.example config/database.yml

$ vi config/database.yml

production:

adapter: mysql

database: redmine2

host: MySql服务器的IP地址

username: redmineUser

password: redminePassword

encoding: utf8

$ vi config/configuration.yml

default:

# Outgoing emails configuration (see examples above) email_delivery:

delivery_method: :smtp

smtp_settings:

address: smtp.exmail.qq.com

port: 25

domain: exmail.qq.com

authentication: :login

user_name: “bugzilla@idste.cn”

password: “iDste1057Bug”

7. 初始化:

$ sudo rake generate_secret_token

$ sudo RAILS_ENV=production rake db:migrate

$ sudo RAILS_ENV=production rake redmine:load_default_data

Select language: ar, bg, bs, ca, cs, da, de, el, en, en-GB, es, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] en

Default configuration data loaded.

8. 安装apache2中的passenger模块

passenger 是一个Apache module,用来帮助在Apache上快速部署 Ruby on rails应用。http://www.modrails.com/documentation/Users guide Apache.html 安装 Passenger需要很多依赖包,在运行 passenger-install-apache2-module 时会提示如何安装缺失的依赖包,这里先给出所有的:

$ apt-get install apache2 apache2-doc libapache2-mod-passenger libcurl4-openssl-dev libssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev

$ sudo gem install passenger

$ sudo passenger-install-apache2-module

根据passenger-install-apache2-module的output, 做如下更改

$ vi /etc/apache2/mods-available/passenger.load

LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-4.0.53/buildout/apache2/mod_passenger.so

$ vi /etc/apache2/mods-available/passenger.conf

<IfModule mod_passenger.c>

PassengerDefaultUser www-data

PassengerRoot /var/lib/gems/1.8/gems/passenger-4.0.53

PassengerDefaultRuby /usr/bin/ruby

</IfModule>

9. 集成redmine和apache2

$ ln -s /opt/mediawiki-1.23.3 /var/www/redmine

$ vi /etc/apache2/sites-available/default

添加以下内容: <Directory /var/www/redmine>

RailsBaseURI /redmine

PassengerResolveSymlinksInDocumentRoot on

</Directory>

10. 重启apache2

$ service apache2 restart

至此,redmine 部署完成, 在浏览器中输入 http://192.168.1.111:3280/redmine 即可访问。